Re:The Resurgence of C Programming
by qwertyuiop924 on Tuesday December 27, 2016 @04:45PM
(#13266466)
Indeed. But my point is that the idea that immidiately presents itself when you think "zero-cost abstraction" is wrong.
>What you do use, you couldn’t hand code any better.
And that will never be true: if you know exactly as much about your usecase as the abstraction, than that might be possible, but that is almost never the case (which was my second point).
Re:The Resurgence of C Programming
by steveklabnik on Tuesday December 27, 2016 @04:58PM
(#13266546)
> And that will never be true
It is often true. Higher-level Rust code can and often does compile into the same assembly (or sometimes better!) than a lower-level construct. That's the entire premise of optimizing compilers. They're not perfect, but they do achieve this goal more often than "never".
See the Option comments above for one trivial example.
> C++ implementations obey the zero-overhead principle: What you don’t use, you don’t pay for [Stroustrup, 1994]. And further: What you do use, you couldn’t hand code any better. - Stroustrup
Everything has costs; that's engineering. But "I chose the wrong data-structure for my task" is not what the slogan is addressing.