In C++, = default and {} are not the same constructor (opens external site)
View full thread · View on Hacker News
To get push notifications on iPhone or iPad, add Hack and Chat to your Home Screen: tap Share → Add to Home Screen, then open the installed app and enable push in Settings.
View full thread · View on Hacker News
Use of references for any non nullable pointer.
RAII for heap allocated types, eventually new/delete, leave malloc()/free() family with sizeof type math for interop with existing C code.
Prefer standard library algorithms with proper bounds checking, instead of memsomething and strsomething function family.
Preprocessor magic, when templates and constexpr are type safe, and can even be single stepped on a modern IDE.
Just some examples out of my mind.
Replies (1)
Replies (2)
Replies (1)
The point being made is that the stumbling blocks exist to be tripped over by the unsuspecting, and are not because of C.
Replies (1)
(Also, this is at least in part inherited from C. Dangling pointers themselves are due to C. And temporary expressions are just acting consistently with C semantics here.)
Replies (1)
[..] One recent real-world example by one of the authors is the following: Improving the following code:
by introducing a getter to have better encapsulation, suddenly caused the undefined behavior: