3 ms·
Your ad hominem attack is totally uncalled for. I've been using C++ for over 20 years and what she says is completely obvious to me. The mental effort you have
by fauigerzigerk 14y ago
Your ad hominem attack is totally uncalled for. I've been using C++ for over 20 years and what she says is completely obvious to me.
The mental effort you have to make to determine the overhead of an expression by looking at the call site is greater in C++ than it is in C.
That's an undeniable consequence of features like operator overloading, constructors, destructors, virtual functions, etc. It has nothing to do with how well you understand the language. The information just isn't there at the call site for you to see.
The question is a different one. It's whether that fact is compensated for by the power and reduced mental effort these features enable elsewhere. Constructors and destructors make RAII possible. That arguably makes memory management a lot easier than in C.
- lutorm 14y agoThe mental effort you have to make to determine the overhead of an expression by looking at the call site is greater in C++ than it is in C. Isn't this just a specific example of saying "the mental effort you have to make to determine the overhead of an expression by looking at the call site is greater in higher-level languages than in lower-level ones"? It's true, precisely because you are using higher-level abstractions. I'd be more interested in seeing an example where this wasn't true.
- loup-vaillant 14y agoThis is besides the point. The only good reason to use C++ is because you (1) need a level of abstraction that C doesn't give you, (2) need level of performance that no garbage collected language can give you (even compiled ones), and (3) can't even use C + Lua (or some other scripting language), probably because you need the abstraction and the performance in the same place. (This is an awfully narrow application domain, compared to what C++ is actually used for) At that point, the performance characteristics of your programs have become part of the specs. You do not want to hide them under the carpet like you would do with a garbage collected language. Yet C++ does. It wouldn't hurt if it syntactically distinguished initializations, casts, calls by reference and so on.
- fauigerzigerk 14y agoThere's some truth in that, but I don't think "higher level" and "lower level" is sufficiently well defined to make that as automatically true as you present it. For instance, languages that allow you to redefine the assignment operator are not necessarily higher level than languages that don't. Or take reference parameters. In C++, if you pass an object to a function you cannot know by looking at the call site if the object is going to be copied or not. The parameter could be defined as a reference, but you have to look at the function definition to find out. In C#, in Java, in Python and in C you know it by looking at the call site. These other languages are all over the place in terms of any high/low level categorization.