News for hackers. Stuff that matters.
Re:GCC and C vs C++ Speed, Measured by adamnemecek on Thursday March 21, 2013 @04:48AM (#5413793)
But isn't GCC still written mostly in C? So would not both gcc versions be expected to be very similar on instruction level?
Re:GCC and C vs C++ Speed, Measured by masklinn on Thursday March 21, 2013 @04:51AM (#5413802)
> So would not both gcc versions be expected to be very similar on instruction level?

It's going to go through the g++ frontend, parsing and compiling it using C++ semantics. There's no guarantee that the C subset of C++ will yield the exact same result as that of an actual C compiler. And a decade or two ago, as TFA notes, it most definitely did not.

Re:GCC and C vs C++ Speed, Measured by adamnemecek on Thursday March 21, 2013 @05:14AM (#5413865)
I guess I just assumed that considering that both compilers are part of the same compiler collection that their output, while not guaranteed to be the same, can be expected to be somewhat similar. And that the divergences should not have all that much of an impact on execution speed. But I guess I did jump to a conclusion there.
Re:GCC and C vs C++ Speed, Measured by masklinn on Thursday March 21, 2013 @07:09AM (#5414240)
The backend should do the same thing, but if the C++ frontend gives complete garbage to the backend, I guess there's only so much the backend can do to fix the mess.