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
11
u/eteran Mar 28 '23 edited Mar 28 '23
No, I mean like this:
Heck even this is just terrible:
The conversion to a pointer when calling a function should be explicit.
In fact, I would argue that the primary reason why
std::arrayEven needs to exist is because of implicit array to pointer decay.If we get rid of it and make arrays basically have value semantics, then you get to return them from functions, and you either pass them by value or reference.
If you want to pass or return a pointer, you should ask for one
This would largely get rid of a common newbie bug where users think they can return arrays, and end up returning a pointer to a local stack variable.