4 ms·
There is a tax that you pay by introducing C++, and that is chasing down things like inadvertent copy constructor/assignment operator calls, automatic memory al
by KKKKkkkk1 10y ago
There is a tax that you pay by introducing C++, and that is chasing down things like inadvertent copy constructor/assignment operator calls, automatic memory allocs, and heavy-weight operator overloads, all of which are an inexhaustible source of untraceable performance bugs. In other words, C++ as a language is right at the sweet spot where it does not guarantee safety, while at the same time making performance unpredictable.
- mrkline 10y ago> inadvertent copy constructor/assignment operator calls This is much less of a problem (and much more controllable!) now that we have move semantics. > automatic memory allocs It's hard to accidentally allocate memory if you don't have a system allocator hooked up. > heavy-weight operator overloads No more heavy-weight than a standard function call, and usually inlined at that.
- omtose 10y agoI never understood why people argue that operator overload is a bad thing. In a language that doesn't support it, you're going to have a function "T add(T, T)" which is pretty much the same, and can do anything. Overloading "T operator+(T, T)" is mostly syntactic sugar.