Live data from Hacker News

Retiring a favourite C++ joke

ignition-training.com

101–110 of 151 posts

Re: Retiring a favourite C++ joke

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

like the other comment said, std::unique_ptr is not ref counted. Ref counting is one of the ways to implement garbage collection but it is not garbage collection by itself. C++ does not have garbage collection.

Re: Retiring a favourite C++ joke

#102
post #57

My favorite C++ joke is this limerick that has been in the standard for a while: When writing a specialization, be careful about its location; or to make it compile will be such a trial as to kindle its self-immolation. https://eel.is/c++draft/temp.expl.spec#8

An other one from the standard: void trex(volatile short left_arm, volatile short right_arm); // deprecated https://eel.is/c++draft/depr.volatile.type#example-3

This is one of the surviving improvements from JF Bastien's P1152 which was initially successful in deprecating most of the spurious use of volatile from C++ with a view to some day getting in there and actually doing MMIO properly.

Unfortunately too much of this will be unwound in C++ 23 because WG21 voted to un-deprecate all the volatile compound operators despite knowing nobody could even offer a rationale for why or how most of them would ever be correctly used.

Re: Retiring a favourite C++ joke

#104
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

A C++ programmer was arrested for indecent exposure. He was caught exposing his private class in public.

Error: missing member reference

Re: Retiring a favourite C++ joke

#105

Earlier quoted context omitted.

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

like the other comment said, std::unique_ptr is not ref counted. Ref counting is one of the ways to implement garbage collection but it is not garbage collection by itself. C++ does not have garbage collection.

C++ does not have garbage collection in the standard library, just as shared_ptr was not part of the standard library in the past. You can currently have optional garbage collection in C++: https://github.com/pebal/sgcl

Re: Retiring a favourite C++ joke

#106

Earlier quoted context omitted.

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.

std::unique_ptr is reference counted, it's just that the count only goes up to BOOL_MAX instead of LONG_MAX.

Re: Retiring a favourite C++ joke

#107

Do modern cars even allow you to step on the accelerator and the brake at the same time?

I guess you technically can’t in an EV with regenerative braking. (But maybe they do have an actual brake pedal?)

EVs always have physical brakes and pedal too in addition to regenerative braking. Regenerative braking can't come close to the braking power of disc or drum brakes especially if the battery is full.

Re: Retiring a favourite C++ joke

#109
post #106

Earlier quoted context omitted.

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.

std::unique_ptr is reference counted, it's just that the count only goes up to BOOL_MAX instead of LONG_MAX.

I think you’re making a joke, but reference counting is different than what a unique pointer does. (a destructor is not the same thing as a reference count, even if that reference count is limited as you suggest.)

Re: Retiring a favourite C++ joke

#110
post #105

Earlier quoted context omitted.

like the other comment said, std::unique_ptr is not ref counted. Ref counting is one of the ways to implement garbage collection but it is not garbage collection by itself. C++ does not have garbage collection.

C++ does not have garbage collection in the standard library, just as shared_ptr was not part of the standard library in the past. You can currently have optional garbage collection in C++: https://github.com/pebal/sgcl

C++ can do pretty much anything, but that doesn't mean that it’s typical to do so. In practice, you will never see a garbage collector in C++.
Post reply on HN