3 ms·
I didn’t realize it was possible to be so wrong.
by freejulian85 7y ago
I didn’t realize it was possible to be so wrong.
- monocasa 7y agoI love C, and have written tons of C++: What the parent is saying is essentially right. C++'s compile time polymorphism and lamdas can allow faster than C given the right subset of language chosen. For instance std::sort regularly outperforms qsort(3).
- otabdeveloper2 7y ago> given the right subset of language chosen Yes, if by that you mean "idiomatic C++ as C++ programmers write it". It's the inexperienced "C/C++" (no such thing, BTW) that are 'choosing subsets', and doing it wrong 90% of the time.
- ncmncm 7y agoThere's no substitute for competence, in any language. Fear of the C++ compiler is not a great predictor of competence.
- monocasa 7y ago> It's the inexperienced "C/C++" (no such thing, BTW) that are 'choosing subsets' That's blatantly not true. Strousup himself contributed to the joint strike fighter C++ coding standard which has things like "Allocation/deallocation from/to the free store (heap) shall not occur after initialization." which means that the STL is off the table for example. Beyond that, there's pieces like RTTI/dynamic_cast that should be avoided for a lot of reasons, perf being one of them.
- ncmncm 7y agoMost of the STL does no allocation. The containers allocate only at known places, permitted during initialization. They also know how to allocate from provided bespoke stores, which are permitted, in JSF code, even after initialization is done. So, no, the STL is very much on the table, as in any competently constructed work product.
- dang 7y agoOk, but please don't be rude or post shallow dismissals here. If you know more, it would be great to share some of what you know. Then we can all learn something. Alternatively, it's fine not to post even when someone else is wrong. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html