3 ms·
> C++ being nearly a strict superset of C is almost by definition more powerful. Not necessarily. In the general case, restrictions can make a language more p
by eru 17y ago
> C++ being nearly a strict superset of C is almost by definition more powerful.
Not necessarily. In the general case, restrictions can make a language more powerful [1], by allowing the user and the compiler to make more assumptions. E.g. removing gotos and mutations seem good ideas.
In the case of C vs C++, removing operator overloading and exceptions could turn out to make the language more powerful.
[1] If you use the right definition of `powerful'. You need a sensible definition that avoids "They are all Turing complete and thus equally powerful."
- dtf 17y agoRemoving operator overloading makes vector and matrix math deeply unpleasant - something that this kind of "creative coding" tends to use rather heavily.
- eru 17y agoI like how Haskell handles operator overloading: You need to conform to some kind of type class, _and_ you can make up your own operators instead of having to reuse bit-shifts for I/O. Oh, I do not really have an opinion on operator overloading in C++. I just conceded the possibility that "removing operator overloading [...] could turn out to make the language more powerful [...]", because I have heard the opinion being advanced with some good arguments.