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