Possible duplicate:
C ++ new int [0] - will it allocate memory?
What should happen when I do this:
int * MakeArray( std::size_t Size ) {
return new int[ Size ];
}
MakeArray( 0 );
We had it outside the code (using VC ++ 2005), and the debug heap complained about a memory block of size 0 that was not freed. Is it standard to return an array of size 0 here?
PS: Please do not tell me to use the vector or check the size before highlighting, I know all this. this is not my code. I'm just curious.
source
share