Just a little something that has been bothering me.
Paul John Falstad
pfalstad at phoenix.Princeton.EDU
Sun Dec 9 13:58:03 AEST 1990
In article <1990Dec08.222943.1581 at cs.widener.edu> sven at cs.widener.edu (Sven Heinicke) writes:
>What is quicker?
>
> int a = 0,i = 0;
>
>or
>
> int a,i;
> i = a = 0;
Depends. If these are local variables, then most likely they will
produce the same code. The latter case is simply postponing the
initialization.
If these are global variables, the former case is quicker (in UNIX,
anyway), since the compiler doesn't have to generate any code to
initialize the two variables. In the latter case, it puts a and i in
bss, but in the former case, it puts them in the initialized data segment.
Your implementation could be totally different however. :-)
--
>From somewhere in front, you hear a repulsive squelching mumble, as if a
chattering orangutan has suddenly had its mouth crammed full of earthworms.
"You're invading my personal space!" shrieks the travel agent, rearing back
from you like an offended snake. She is probably from California.
More information about the Comp.lang.c
mailing list