It's one joke Martin. What could it cost, ten dollars?
Retiring a favourite C++ joke
71–80 of 151 posts
Re: Retiring a favourite C++ joke
#72[flagged]
Re: Retiring a favourite C++ joke
#73I've read it "Rewriting ..." . You guess in what exactly.
Re: Retiring a favourite C++ joke
#74Do modern cars even allow you to step on the accelerator and the brake at the same time?
Why wouldn't they? The brake simply overrides the accelerator.
Re: Retiring a favourite C++ joke
#75It's an OK C++ joke, but not great. I could certainly give the author a few pointers...
Re: Retiring a favourite C++ joke
#76Earlier quoted context omitted.
Why wouldn't they? The brake simply overrides the accelerator.
Sportier drivers may wish to brake and accelerate simultaneously (rev matching, weight transfer tricks). Normal cars just cut fuel when braking to avoid two-foot drivers burning their brakes.
Re: Retiring a favourite C++ joke
#77I was surprised to see it not mentioned in the post -- the most obvious reason this joke should be retired is not the reference to a television show but rather the modern practice of never using new or delete at all in C++ code. Modern C++ avoids these pitfalls and I think it's been 10 years since I've written the words the new or delete.
> the modern practice of never using new or delete at all in C++ code What? How do you (de)allocate memory without new and delete? If the answer is "smart pointers" then why bother use C++ in the first place, just use Go or something.
Re: Retiring a favourite C++ joke
#78I was surprised to see it not mentioned in the post -- the most obvious reason this joke should be retired is not the reference to a television show but rather the modern practice of never using new or delete at all in C++ code. Modern C++ avoids these pitfalls and I think it's been 10 years since I've written the words the new or delete.
> the modern practice of never using new or delete at all in C++ code What? How do you (de)allocate memory without new and delete? If the answer is "smart pointers" then why bother use C++ in the first place, just use Go or something.
Re: Retiring a favourite C++ joke
#79I was surprised to see it not mentioned in the post -- the most obvious reason this joke should be retired is not the reference to a television show but rather the modern practice of never using new or delete at all in C++ code. Modern C++ avoids these pitfalls and I think it's been 10 years since I've written the words the new or delete.
> the modern practice of never using new or delete at all in C++ code What? How do you (de)allocate memory without new and delete? If the answer is "smart pointers" then why bother use C++ in the first place, just use Go or something.
It's fairly simple:
instead of new --> make_unique(); this returns a pointer, but it will automatically delete its memory when it goes out of scope.
instead of delete --> do nothing; the memory is deleted when you don't need it any more.
There are additional API methods on the unique pointer that allow you to do other things for flexibility, but while continuing that memory safety.
This is nothing at all like a GC language like Go.
Re: Retiring a favourite C++ joke
#80I was surprised to see it not mentioned in the post -- the most obvious reason this joke should be retired is not the reference to a television show but rather the modern practice of never using new or delete at all in C++ code. Modern C++ avoids these pitfalls and I think it's been 10 years since I've written the words the new or delete.
I frequently work with companies that have old, large codebases. A key requirement of the training in that environment is that attendees are able to read existing production code. In some cases that's over twenty years old and millions of lines of code. new/delete is just part of that reality. We teach them without encouraging their use.