When do you use "if ( a = b )"? (was Re: Funny mistake)

Jim Giles jlg at cochiti.lanl.gov
Wed Mar 20 07:12:13 AEST 1991


In article <11109 at dog.ee.lbl.gov>, torek at elf.ee.lbl.gov (Chris Torek) writes:
|> [...]
|> Smaller source code, yes.  Smaller or faster object code---well, if
|> your compiler generates different code for
|> 
|> 	if (a = b)
|> 
|> than for
|> 
|> 	a = b;
|> 	if (a)
|> 
|> then your compiler is not worth what you paid for it.  [...]

Even if it was _free_!  The above 'optimization' was present
in Fortran compilers more than 30 years ago - and their _fastest_
machines were slow compared to today's micros (so the excuse that
doing the above analysis makes the compiler too slow or complex is
garbage).

J. Giles



More information about the Comp.lang.c mailing list