top | item 29681853

(no title)

thebackup | 4 years ago

Premature optimization is a common disease amongst C and C++ devs. I often come across code that is written in an obscure/complex way just because someone thought execution speed triumphs code readability. In most cases (around 9 times out of 10) it is on a non-time-critical path of the code and the developer who wrote it didn't even bother to run a profiler on it. My work would be significantly easier if we could learn to prioritize code readability.

discuss

order

mgaunard|4 years ago

The point of those languages is to make it explicit when you're doing ridiculously costly things so that you're forced to do a reasonable implementation instead.

klyrs|4 years ago

No, any language that allows operator overloading can hide ridiculously costly operations behind mundane-looking code. C is pretty good about that, but C++ is not: you can even overload the comma operator!

tylerhou|4 years ago

I disagree that C++ makes expensive operations explicit; see the copy constructor and the copy assignment operators. C, maybe.