Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!news.funet.fi!uta!kielo!av From: av@kielo.uta.fi (Arto V. Viitanen) Newsgroups: comp.lang.c Subject: Re: When do you use "if ( a = b )"? (was Re: Funny mistake) Message-ID: Date: 20 Mar 91 06:47:24 GMT References: <8148@rsiatl.Dixie.Com> <15481@smoke.brl.mil> <775@camco.Celestial.COM> <65837@eerie.acsu.Buffalo.EDU> <1991Mar18.195351.11985@unlv.edu> <11109@dog.ee.lbl.gov> Sender: news@uta.fi Reply-To: av@uta.fi (Arto Viitanen) Organization: University of Tampere, Finland Lines: 31 Nntp-Posting-Host: uta.fi In-reply-to: torek@elf.ee.lbl.gov's message of 19 Mar 91 19:13:45 GMT >>>>> On 19 Mar 91 19:13:45 GMT, torek@elf.ee.lbl.gov (Chris Torek) said: Chris> X-Local-Date: Tue, 19 Mar 91 11:13:46 PST Chris> In article <1991Mar18.195351.11985@unlv.edu> grover@sonny-boy.cs.unlv.edu Chirs> ---well, if Chris> your compiler generates different code for Chris> if (a = b) Chris> than for Chris> a = b; Chris> if (a) Chris> then your compiler is not worth what you paid for it. I checked those differences with SUN's cc (SUN3/SunOs 4.0.3) and GNU cc (version 1.39) In SUN's cc there was differences when optimization was turned off; they generated same assembler code whith optimization. In GNU cc, it was other way round: without optimization, assembler code was same, but with optimization, they were different. I think GNU cc is still worth it price !! Chris> In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427) Chris> Berkeley, CA Domain: torek@ee.lbl.gov -- Arto V. Viitanen email: av@kielo.uta.fi University Of Tampere, av@ohdake.cs.uta.fi Finland