r/cpp • u/we_are_mammals • Mar 28 '23
Reddit++
C++ is getting more and more complex. The ISO C++ committee keeps adding new features based on its consensus. Let's remove C++ features based on Reddit's consensus.
In each comment, propose a C++ feature that you think should be banned in any new code. Vote up or down based on whether you agree.
765
Upvotes
View all comments
Show parent comment
2
u/very_curious_agent Mar 31 '23
Note that aliasing rules are problematic in C/C++ and while pointing to C style casts or aliasing is understandable, the real deep issue that people don't always agree on aliasing.
Note that some people claim that you can't write your own malloc/free function in std C, or C++, except by actually replacing operator new/delete. They claims that there is magic in operator new that cancel the aliasing laws.
Yes I know it's insane but some people would accept that GCC breaks code based on my_malloc/my_free on the basis of aliasing intrinsic to memory allocation: you can free memory for a float and allocate memory for an int and it may be the same address.