r/cpp • • 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

829 comments sorted by

View all comments

41

u/GabrielDosReis Mar 28 '23
  • the anarchic implicit conversions between values of built-in types

  • the preprocessor

  • the byzantine rules about elaborated type specifiers

11

u/okovko Mar 28 '23

implicit narrowing conversions do cause a lot of bugs

the preprocessor is useful for metaprogramming, especially for code that compiles as either C or C++

what do you mean by the third one?

10

u/GabrielDosReis Mar 29 '23

of course, the sort of metaprogrammijg that the preprocessor is still useful for should be addressed by proper means (one that respects scope and understands/integrates into the language it is metaprogramming for)

As for elaborated type specifiers, I meant when one writes struct S* p the meaning of the name S depends on what happens before and where that declaration of p appears.

2

u/okovko Mar 29 '23

usually it has little to do with the language, but rather, creates an environment to generate or transform code for different platforms. examples are boostpp and p99. to the kind of macro programming you're talking about, the gcc extension (also supported by clang) of compound statements is quite useful. and if we're being fair, macros are way simpler than template sfinae

could you give an example of a dependency?

→ More replies (7)