Alan Kennington <[EMAIL PROTECTED]> wrote:
> This is not really a problem.
>It's just curiosity....
>
>I've just broken up a program from about 3 modules (by which I mean
>c-file/h-file pairs) into about 12 modules, basically a 
>module for each form, and some other stuff.
>
>Normally, when I break up software into a large number of modules,
>I expect the total binary executable to increase in size,
>because certain things get duplicated in each module.
>
>But in this case, my code1.xxxx.grc file went down from 30 kBytes to
>a mere 24 kBytes. This is an astonishing decrease.
>
>Does anyone happen to know why the code size should reduce
>at all, let alone why it reduces by so much?
>

If you compile with optimization (-O), gcc will inline function calls,
increasing speed at the expense of space.  Functions in a different C file
can't be inlined, so using more files can reduce code size.  Also, I think
the fact that gcc consolidates all object files into one code resource
eliminates some of the redundancy that normally occurs with modularization.
 However, it doesn't seem like these factors can account for a 20%
decrease.

Ben


Reply via email to