This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ vs. C asm/object file size


Joe Buck wrote:

> Theoretically you will get the same object code from the same source code
> (if your input language is in the common C/C++ subset), because C++ and C
> are both converting to the same intermediate form and using the same
> backend (provided that you disable exceptions).
>
> In practice, you may find some differences.  If you do, it would be useful
> to figure out why, so that we can get better code.  I recall that in the
> past, there were some optimizations that didn't occur in the C++ front end
> but did in the C front end, but this was unintentional and could be fixed.

    OK - looks like my problem (seeing identical .s output but different .o
results) was a fluke or mistake on my part. I now have it turn off rtti and
exception handling for the C++ build and the only difference is the size of the
symbol names due to name mangling. using -fnew-abi  reduces the size differences
again. Otherwise it appears that the asm output is identical (which is good).
Now I need to start extern "C"'ing the header files and I should end up with
identical asms and object files. If I do spot a difference then I'll let the
list know.

    later,

        Ben Scherrey


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]