News for hackers. Stuff that matters.
Re:C++ Papercuts by fsloth on Monday August 28, 2023 @08:56AM (#37293232)
"get any senior dev to move away from using references instead of const pointers." ... "the reader has no idea whether the argument will be modified or not without reading the header file."

It sounds like the problem is not using an IDE.

Use references whenever posssible. Then you don't need to do a null pointer check. C++ is a footgun. And like with all guns, security first. With guns - put the safety on. With C++ - check the pointers are not null.

OFC one can argue that with proper instrumentation invalid pointers are captured sooner than later, but the fact is it's much easier to represent invalid program state using pointer than references.

Re:C++ Papercuts by thecodedmessage on Monday August 28, 2023 @01:36PM (#37297685)
Yes, the "C++ is not usable on its own and needs other tools" defence of C++ :-)
Re:C++ Papercuts by PaulDavisThe1st on Monday August 28, 2023 @02:14PM (#37298280)
In my experience (31 years of C++) it is much more likely that problematic pointers will be non-null but also invalid.