Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I never heard Stroustrup using the term "zero cost", but only "zero overhead".


Here is a kind of reference to the matter,

"What you don’t use, you don’t pay for. And further: What you do use, you couldn’t hand code any better."

https://boats.gitlab.io/blog/post/zero-cost-abstractions/


Here is the relevant paragraph from Stroustrup, B (2013): The C++ programming language, 4th edition. Pearson Education, page 10:

"What you don’t use you don’t pay for. If programmers can hand-write reasonable code to simulate a language feature or a fundamental abstraction and provide even slightly better performance, someone will do so, and many will imitate. Therefore, a language feature and a fundamental abstraction must be designed not to waste a single byte or a single processor cycle compared to equivalent alternatives. This is known as the zero-overhead principle."

I don't know who came up with "zero cost" abstractions, but it's wrong since there is no zero cost. For the people chanting "zero cost" the cost might not be obvious though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: