Retiring a Favourite C++ Joke

March 16, 2023   Martin Jones
Time to retire a favourite C++ joke.

I have a favourite joke when teaching new and delete in C++. Alas, I believe that attendees are now less likely to have seen the show it references. Therefore, I present it here for your enjoyment (or not).

void fn()
     int tobias;

     delete &tobias;
You must never delete a never-newed.

If you have not watched Arrested Development, then the joke won’t make any sense without a bit of context: