Mail Archives: djgpp/1997/02/16/14:46:10
> I just finished writing a C++ implementation of a circular linked list.
>
> My question is this. If I use delete on a pointer which is equal to
> NULL,
> for example...
>
> char *ptr = NULL;
>
> delete ptr;
>
[snip]
It would be very advisable to something like:
if (ptr != NULL)
delete ptr;
I imagine it's very bad to delete a NULL ptr, but as I don't know the C++
specification to those kind of details, it may be perfectly legal. Still,
it's poor practice to operate on a NULL ptr in any way.
>
> TIA
>
> -Fwec
>
Good luck.
- Raw text -