GCC 3.0.3 produces large code

Nicholas Adrian Vinen hb@x256.org
Thu Jan 31 10:57:00 GMT 2002


> I'm not sure about that topic, but I don't think that code size reduction
> is pushed too far in the development process of gcc, since it isn't used
> by too many people ?! I would be interested in the results of -O2
> replacing -Os. The code structure optimizations of -O2 may also result
> in a reduction of code size.

   Actually the difference between -O2 and -Os is almost nothing.

> BTW. in my opinion is the usage of two return statements in one function
> a design fault. It is also remarkeble that the most cleanest code
> concerning function design compiles into the smallest result. That's
> exactly what I want from my gcc.

   Well, C obviously permits it, otherwise there would be no "return"
statement... you'd just "return" the value of the last statement or
something. And I'm obviously not using C++ because I want a portable
assembler... I expect a C++ compiler to do a lot of optimisation. It has
to to make object oriented code at all efficient. Most C++ compilers do a
somewhat decent job of this.

   Also, I think that GCC should be at least as good as other C++
compilers in most respects. It's unfortunate that Visual C does a far
superior job of code size optimisation. The performance advantages GCC has
(if any) aren't worth the tradeoff in code size, I don't think. Not that
Visual C is a good compiler, but they obviously worked hard on this aspect
of it.

   I guess to reiterate, my main objection to your objections are twofold:
I don't want to have to edit all my code just to get it to produce good
output in GCC, it should be slightly smart about it. And I think C++ is
way beyond the point these days where I expect to have to optimise every
little thing in the code. If I wanted that I'd write in C.

      Nicholas




More information about the Gcc mailing list