Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!udel!princeton!phoenix.Princeton.EDU!pfalstad From: pfalstad@phoenix.Princeton.EDU (Paul John Falstad) Newsgroups: comp.lang.c Subject: Re: Just a little something that has been bothering me. Message-ID: <4586@idunno.Princeton.EDU> Date: 9 Dec 90 02:58:03 GMT References: <1990Nov30.180913.20890@clear.com> <1990Dec08.222943.1581@cs.widener.edu> Sender: news@idunno.Princeton.EDU Organization: Princeton University, Princeton, New Jersey Lines: 26 In article <1990Dec08.222943.1581@cs.widener.edu> sven@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.