by kjuulh · 1y ago · 0 comments
Better than nothing, and might be the most preferred way of doing things in C++, but it does seem dangerous to me. ;)
What I got frustrated with in C/C++ is the insanity of each and every third-party library redefining every type. I understand the history and reasoning behind this, but it's one of those things that ought to have been fixed in the early 2000s, not decades later when it's too late.
I would have loved it if this warning was on by default but sadly, you have to know to turn it on.
An easy start is to use `-Wall -Wextra -Wpedantic` for gcc and clang compilers. I would now add `-Wdeprecated-copy-dtor` to the list but I only learned about it writing this article.
A static analisys tool can enforce the rule as well- you should have one.
unfortunately though this is one area that because c++ predates RAII it can't changethe defaults without breaking a lot of code. I am saying the problem is manageable - there is a real problem though. If you make a new language learn from this mistake.
The Design and Evolution of C++ is quite clear on how this process came to be, during C++ design as language.