c++ - Is it safe to delete a NULL pointer? -
is safe delete null pointer?
and coding style?
delete
performs check anyway, checking on side adds overhead , looks uglier. very practice setting pointer null after delete
(helps avoiding double deletion , other similar memory corruption problems).
i'd love if delete
default setting parameter null in
#define my_delete(x) {delete x; x = null;}
(i know r , l values, wouldn't nice?)
Comments
Post a Comment