Path: utzoo!attcan!uunet!fernwood!apple!sun-barr!cs.utexas.edu!wuarchive!psuvax1!rutgers!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.misc Subject: Re: C's sins of commission Message-ID: <2440:Nov607:32:5890@kramden.acf.nyu.edu> Date: 6 Nov 90 07:32:58 GMT References: <3673@stl.stc.co.uk> <1990Nov2.052815.22188@murdoch.acc.Virginia.EDU> Organization: IR Lines: 25 In article <1990Nov2.052815.22188@murdoch.acc.Virginia.EDU> gl8f@astsun9.astro.Virginia.EDU (Greg Lindahl) writes: [ on one type of aliasing problem ] > a[i] = b[i] / c[i]; > d[i] = b[i] * c[i]; [ Fortran sees separate arrays and loads b[i] and c[i] only once ] [ C sees possible aliasing and loads them twice ] Hmmm. I would almost automatically optimize the above into { register double bi = b[i]; register double ci = c[i]; a[i] = bi / ci; d[i] = bi * ci; } Don't ask me to philosophize about this fragment. > but > don't make my code run 30% slower. Hey, dude, write it 30% faster in the first place. ---Dan