Path: utzoo!mnetor!uunet!husc6!think!ames!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpda!hpcuhb!hpcllla!hpcllz2!walter From: walter@hpcllz2.HP.COM (Walter Murray) Newsgroups: comp.lang.c Subject: Re: I forget what it was originally called. Message-ID: <7330001@hpcllz2.HP.COM> Date: 11 Mar 88 22:37:39 GMT References: <3505@bloom-beacon.MIT.EDU> Organization: HP ITG/ISO Computer Language Lab Lines: 31 > Which brings me to another question: How good are compilers these > day? Can they optimize just as well as a programmer (without > resorting to assembly, that is) or not? For example: > > A) > temp = {expression} > a[temp] = 1; > b[temp] = 2; > c[temp] = 3; > B) > a[temp={expression}]=1; > b[temp]=2; > c[temp]=3; > C) > a[{expression}]=1; > b[{expression}]=2; > c[{expression}]=3; > D) > { > register temp; > temp = {expression}; > . > . > . > } I tried these on the HP C compiler on an HP 9000 Series 800 and (with optimization turned on) got the same code for all four approaches. Walter Murray