proper way to delete an array

Started by
10 comments, last by GekkoCube 20 years, 7 months ago
I like doing it in one statement (appearance-wise) by using the comma operator:

delete [] foo, foo = 0;

but I understand why some people don''t like it.
---CyberbrineDreamsSuspected implementation of the Windows idle loop: void idle_loop() { *((char*)rand()) = 0; }
Advertisement
Note that if you''re following RAII, you''ll only be using delete in destructors. In this case, setting the pointer to 0 is obviously pointless.

This topic is closed to new replies.

Advertisement