Mail Archives: djgpp/1997/02/16/12:57:56
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;
Will anything bad happen? I have written the linked list to be as simple
as
possible, and as such only one node will ever have a pointer in it
pointing
to NULL. This node is the dummy node at the beginning of the list, and I
end up calling delete on it in one of my destructors.
Do I need to avoid this? Will this become some horrific bug much later
in
my project?
TIA
-Fwec
- Raw text -