Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!utarlg.utarl.edu!c145gmk From: c145gmk@utarlg.utarl.edu (GORDON KEEGAN) Newsgroups: comp.lang.c Subject: Re: Just a little something that has been bothering me. Message-ID: <10784@helios.TAMU.EDU> Date: 10 Dec 90 23:11:45 GMT References: <2753F21B.2F6@tct.uucp> <1990Nov30.180913.20890@clear.com> <1990Dec08.222943.1581@cs.widener.edu> Sender: news@helios.TAMU.EDU Reply-To: c145gmk@utarlg.utarl.edu Organization: The University of Texas at Arlington Lines: 39 News-Software: VAX/VMS VNEWS 1.3-4 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; > >and why? > >This type of thing has been bothering me for a long time. Our C compiler under VMS 5.3-1 produced the following assembler code for the respective C segments: int a=0, i=0; F8 AD 00 D0 000B movl #0,-8(fp) F4 AD 00 D0 000F movl #0,-12(fp) and int a, i; i = a = 0; F8 AD 00 D0 000B movl #0,-8(fp) F4 AD F8 AD D0 000F movl -8(fp),-12(fp) The second will be marginally slower, but only just... ----------------------------------------------------------------------------- | Gordon Keegan || Bitnet : c145gmk@utarlg | | Systems Programmer || THEnet : UTARLG::C145GMK | | Academic Computing Services || Internet: c145gmk@utarlg.utarl.edu | | University of Texas, Arlington || AT&TNet : 817-273-2208 | ----------------------------------------------------------------------------- | Beauty does what beauty does best: it's beautiful... | -----------------------------------------------------------------------------