Mail Archives: djgpp/1998/06/23/11:33:30
>Should be something like:
>
> for (i=0;i<XSize; i++)
> delete Tiles[i];
> delete Tiles;
Never do it! Modern C++ has new[] and delete[] operators especially
for arrays. The right form will be
for (i=0;i<XSize; i++)
delete [] Tiles[i];
delete [] Tiles;
Note that operator new[] (it is invoked for an array allocation) can use
other heap format (perhaps, other heap on some platforms). For example
new[] would allocate additional memory to store a number of array elements
for the sake of providing information on an array size to delete[] operator.
if you do something like 'char *a=new char[10]' and try 'delete a', it would
cause run-time heap corruption errors.
----------------------------------------------------------------------
Aleksey Kondratyev
Ph.D. student of Ulyanovsk state University, Russia
http://www.mv.ru/~akondra
E-mail akondra AT mmf DOT univ DOT simbirsk DOT su
akondra AT mv DOT ru
If the address above contains no-spam-, please,
remove it when replying.
- Raw text -