News for hackers. Stuff that matters.
Re:Modern C++ for C Programmers: part 5 by jcelerier on Wednesday July 25, 2018 @10:25AM (#17609473)
No, C has much less RVO allowed than C++. I provided an example of this here the last time : https://news.ycombinator.com/item?id=17216250
Re:Modern C++ for C Programmers: part 5 by stephencanon on Wednesday July 25, 2018 @12:11PM (#17610357)
From what I can see, the example you list there is just a missed optimization in the C compilers you tested. It's absolutely allowed, and clang trunk is happy to do it in C-mode, for example.
Re:Modern C++ for C Programmers: part 5 by petters on Wednesday July 25, 2018 @12:55PM (#17610760)
There could be some more fundamental differences due to the requirement that different objects require different pointers that prevent some optimizations.