Live data from Hacker News

Retiring a favourite C++ joke

ignition-training.com

81–90 of 151 posts

Re: Retiring a favourite C++ joke

#81
post #63
post #51

Earlier quoted context omitted.

No, it’s not just theory. Like anything in C++, codebases and their styles widely vary. But my comment holds true for the vast majority of developers I have worked with over the last decade. With the exception of the special “placement new“ operator, it is nearly obsolete to use new and delete.

I suggest browsing around code from Microsoft, Google, Apple,... Plus there are those tons of enteprise code, hardly the "vast majority". The only place I see modern C++ as advocated, it at C++ conference talks, and my own hobby coding.

If you are going to work with a legacy codebase, then sure. My comment was more about fresh codebases, which are fortunately the only ones I've worked on.

Re: Retiring a favourite C++ joke

#82
post #17

Even the compilers are in on some jokes: $ gcc -xc - : In function ‘main’: :1:45: error: ‘long long long’ is too long for GCC

They should build ChatGPT into compilers so you can complain.

You: $ gcc -xc - Compiler: :1:45: error: ‘long long long’ is too long for GCC

You: Do it again, damn it, but this time show no errors!

Re: Retiring a favourite C++ joke

#83
post #45
post #17

Even the compilers are in on some jokes: $ gcc -xc - : In function ‘main’: :1:45: error: ‘long long long’ is too long for GCC

I made this compiler joke and received whoping 930 upvotes for it: https://i.redd.it/dp6ixt4ri1hz.png

Ha! It actually took me far too long to get it!

Re: Retiring a favourite C++ joke

#84
post #78
post #68

Earlier quoted context omitted.

> 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.

Why would you respond to a comment about a topic you don't understand and spread false information? You clearly cannot tell the difference between garbage collected language and smart pointers.

Ah, so reference counting is not considered a form of garbage collection any more? Ingenious but somewhat of dishonest.

Re: Retiring a favourite C++ joke

#85
post #81
post #63

Earlier quoted context omitted.

I suggest browsing around code from Microsoft, Google, Apple,... Plus there are those tons of enteprise code, hardly the "vast majority". The only place I see modern C++ as advocated, it at C++ conference talks, and my own hobby coding.

If you are going to work with a legacy codebase, then sure. My comment was more about fresh codebases, which are fortunately the only ones I've worked on.

A niche in the C++ world.

Re: Retiring a favourite C++ joke

#86
post #17

Even the compilers are in on some jokes: $ gcc -xc - : In function ‘main’: :1:45: error: ‘long long long’ is too long for GCC

The old MPW compiler had some gems: https://www.cs.cmu.edu/~jasonh/personal/humor/compile.html > This label is the target of a goto from outside of the block containing this label AND this block has an automatic variable with an initializer AND your window wasn't wide enough to read this whole error message

On template expansion failures, I'd love a modern GCC reporting "your window wasn't tall enough to read this whole error message"

Re: Retiring a favourite C++ joke

#89
post #78

Earlier quoted context omitted.

Why would you respond to a comment about a topic you don't understand and spread false information? You clearly cannot tell the difference between garbage collected language and smart pointers.

Ah, so reference counting is not considered a form of garbage collection any more? Ingenious but somewhat of dishonest.

Smart pointers do not necessarily use reference counting. std::shared_ptr is reference counted, but std::unique_ptr is not. Needless to say that std::unique_ptr should always be the default choice and std::shared_ptr only used when actually needed.
Post reply on HN