[OT] Re: why a main() function?

Dan Sommers me at privacy.net
Mon Sep 18 21:27:12 EDT 2006

On 18 Sep 2006 14:38:12 -0700,
bearophileHUGS at lycos.com wrote:

> ...  There is another secondary advantage: the code inside a function
> runs faster (something related is true for C programs too). Usually
> this isn't important, but for certain programs they can go 20%+
> faster.

Okay, I give up.

AFAIK, All C code must be inside a function, unless you count the
expressions in initializers.

So aside from certain CPU/MMU/OS/cache/etc. quirks, why would C code
inside a function run faster than C code outside a function?  Compiler
optimizations because of const and restrict keywords don't count.

And what other C code *isn't* inside a function?


Dan Sommers
"I wish people would die in alphabetical order." -- My wife, the genealogist

More information about the Python-list mailing list