Re:Popular Myths about C++, Part 1
by mike-cardwell on Tuesday December 09, 2014 @03:02PM
(#8725295)
Made no difference
Re:Popular Myths about C++, Part 1
by maxlybbert on Tuesday December 09, 2014 @04:56PM
(#8726088)
Thanks. It was worth a shot. Which version of GCC are we talking about?
Re:Popular Myths about C++, Part 1
by mike-cardwell on Tuesday December 09, 2014 @05:23PM
(#8726257)
The different versions of gcc and clang that I tried are higher up in this thread: https://news.ycombinator.com/item?id=8722519
gcc -std=c99 -O3 -Wall -Wextra test.c -o test
g++ -std=c++11 -O3 -Wall -Wextra test.cpp -o test
In my experience, C++ compilers are great at eliding temporaries and various constructor calls (and related memory allocations), but only if optimizations are turned on.