2 ms·
Would you really say that this sort of complexity is just down to writing indecipherable bad code? https://isocpp.org/blog/2012/11/universal-references-in-c11-
by fauigerzigerk 9y ago
Would you really say that this sort of complexity is just down to writing indecipherable bad code?
https://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers https://isocpp.org/blog/2012/11/universal-references-in-c11-...
In my view C++ is a very complex language that only few people can write safely and productively.
When you say "I understand my code" I have to believe you. The problem is that understanding other people's C++ code takes ages, even if they don't abuse the language. Trusting their code is another story entirely.
C++ is a very flexible language in that it puts few restrictions on redefining the meaning of any particular syntactic expression.
That's great, but it also means that there is a lot of non-local information that you have to be aware of in order to understand what any particular piece of code actually does.
I'm not surprised that C++ is both loved and hated and perhaps even more often simply accepted as the only practical choice.
There aren't many widely used languages around that allow us to optimize our code almost without limit and at the same time provide powerful abstraction facilities.
At the same time, there aren't many widely used languages around that make reading other people's code as difficult as C++ (even well written code) and come with a comparably long tail of accumulated historical baggage.
- pjmlp 9y agoHaskell, Common Lisp, Ada, Scala, OCaml, F# come to mind. Even Java and C# are slowly getting down that path. Languages get those features because they make sense and solve real production problems.
- 72deluxe 9y agoYes universal references take a while to understand. I read Scott Meyer's book and the chapter dedicated to it took some getting used to, and note taking. The language is dealing with some tricky concepts. To hide them or try to gloss over them would lead to writing virtual machines and bloated memory usage etc. in the style of C# / Java. How else would you deal with movement of variables and when an rvalue becomes an lvalue inside a function?