RE: [AD] fixes.. malloc() |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
> No, this makes perfect sense. It helps (greatly) to improve
> readability,
> reliability, etc. And C++'s delete operator can be used on a
> 0 pointer
> with no problem. The only possible 'wart' is the fact that
> the pointer
> isn't reset to 0 after freeing - something that is very annoying and
> the cause of many, many bugs.
That's just bad coding. Both having deletion of 0 valid and resetting
the pointer to NULL would encourage sloppy things such as freeing
twice. Boo to that. It's one thing to help the programmer, but quite
another to silently accept wrong things. And, in my view, freeing or
deleting a NUL pointer is a wrong thing. Even if legal.
That said, if you want to remove the tests, feel free.
--
Vincent Penquerc'h
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |