4 ms·
I think the proper rant would be about ambiguous spec which leads to strange outputs from different compilers, then results in very hacky ways to provide even s
by stonewhite 11y ago
I think the proper rant would be about ambiguous spec which leads to strange outputs from different compilers, then results in very hacky ways to provide even some level of portability.
It may not provide enough abstractions to match your awesome Ruby on Rails application for your next great startup but that is OK. Lets try to remember that C was invented to avoid writing Unix in assembly, which all previous OS'es were written in. So abstraction-wise it supplies enough abstraction for its time and usage.
- qznc 11y agoC does not provide zero-cost abstractions like C++ does. This means for example that the standard library sort in C++ is faster than in C, because it can inline the comparison function.
- Horusiath 11y agoYour example is not zero-cost. You've simply traded program memory for CPU cycles. Not always fair trade in cases, where C is used.
- forgettableuser 11y agoGreat point about this example being a code-size trade-off example and not an actual zero-cost example. As for actual zero-cost optimization, Chandler Carruth who works on Clang at Google gave a talk at the 2012 LLVM Developers' Meeting warning people that C++ zero-cost abstractions are more myth than reality, and things developers expect to be zero-cost are often in-fact not. He goes into detail about how the optimizers work and what the challenges are. http://llvm.org/devmtg/2012-11/videos/Carruth-OptimizingAbstractions.mp4 http://llvm.org/devmtg/2012-11/videos/Carruth-OptimizingAbst...