|
|
|
|
|
by mehrdadn
2121 days ago
|
|
With the caveat that I am NOT suggesting this justifies choosing C over C++, I just wanted to mention this talk about how "zero-cost abstraction" is an idealism, not necessarily a reality:
https://www.youtube.com/watch?v=rHIkrotSwcc&t=17m30s That said, I tried to reproduce something similar, and it seems the issue only occurs in my example due to external linkage (adding 'static' fixes it)... but I can't claim this will always resolve the issue:
https://gcc.godbolt.org/z/1vbqo3 |
|
Any argument that smart pointers are not zero cost to the language because they have a cost when you use them is a classic straw man argument.