|
배열을 delete할때는
input_layer::~input_layer()
{
delete [] outputs;
delete [] orig_outputs;
}
이렇게 합니다..
이상민 님이 쓰신 글 :
: input_layer::input_layer(int i, int o)
: {
: num_inputs=i;
: num_outputs=o;
:
: outputs = new float[num_outputs];
: orig_outputs = new float[num_outputs];
: }
:
: input_layer::~input_layer()
: {
: delete [num_outputs] outputs;
: delete [num_outputs] orig_outputs;
: }
:
: 위와 같이 생성자에서 new로 할당된 메모리를 소멸자에서 delete를 사용해서 제거했습니다. 그랬더니. "[C++ Warning] NNProc.cpp(259): W8016 Array size for 'delete' ignored" 와 같은 warning이 나오더군요..
:
: 그래서 help를 보았더니,
: The C++ IDE issues this warning when you've specified the array size when deleting an array.
: With the new C++ specification, you don't need to make this specification. The compiler ignores this construct.
: This warning lets older code compile.
: 이라고 나오는 군요..
:
: 흐~~ 제가 가지고 있는 C++기초 플러스 2판에는 소멸자에서 delete로 메모리 해제를 해야된다고 나와있는데.. C++ 규약이 바뀐것인가요 ?
:
: 누가 좀 알려주세요.. (__)
|