2 ms·
With C++ one needs discipline to make up for the lack of type safety that one can get in other languages. This is of course not so great, because it relies on t
by blub 11y ago
With C++ one needs discipline to make up for the lack of type safety that one can get in other languages. This is of course not so great, because it relies on the programmer to know various idioms/patterns.
In your example, it would be a major red flag in code review to create a reference like that. Some code constructs are just asking for trouble.
I think the reasons behind still having errors despite tools like Valgrind and ASan are:
a) many devs don't know about them or use them
b) you need 100% coverage to remove all errors
Using said engineering practices will not result in a completely big-free program, but it will have a significant impact on the quality. For something that doesn't have the nightmare security profile of a browser or various other exposed services, that can be just fine, even if not ideal.