Article View: comp.sys.ibm.pc.programmer
Article #105Re: Best C Compiler
From: Joseph H Allen
Date: Wed, 21 Mar 1990 06:21
Date: Wed, 21 Mar 1990 06:21
30 lines
1621 bytes
1621 bytes
In article <9873@wpi.wpi.edu> jhallen@wpi.wpi.edu (Joseph H Allen) writes:
>The only wierdness is the
>way it handles postincrement (and this weirdness is not incorrect.. it's just
>weird and slightly slower).
Oops... my apologies to zortech. I was quite mistaken about what other
compilers do and my understanding of C. In particular, this program:
main()
{
int a=0;
int *b= &a;
printf("%d\n", (*b) + (a++) );
}
Produces the result '1' on all compilers I've tried it on except GNU C, where
it produces the result '0'.
Most compilers assume 'a++' means "move a to tmp, increment a, use tmp for
rest of expression"
I (and I guess RMS too) thought it meant "use a for expression. When
expresion is finished, increment a" I think this definition is slightly
faster since with it one less register is free to use for other things in an
expression. But K&R doesn't say which is to be used so I guess they're both
right.
--
"Come on Duke, lets do those crimes" - Debbie
"Yeah... Yeah, lets go get sushi... and not pay" - Duke
Technical Details
Message-ID:
<9954@wpi.wpi.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!husc6!m2c!wpi!jhallenReferences:
<1722@geocub.greco-prog.fr> <1264@doitcr.doit.sub.org> <1990Mar19.175316.16898@Octopus.COM> <9873@wpi.wpi.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!husc6!m2c!wpi!jhallen From: jhallen@wpi.wpi.edu (Joseph H Allen) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: Best C Compiler Keywords: Compilers Message-ID: <9954@wpi.wpi.edu> Date: 21 Mar 90 06:21:09 GMT References: <1722@geocub.greco-prog.fr> <1264@doitcr.doit.sub.org> <1990Mar19.175316.16898@Octopus.COM> <9873@wpi.wpi.edu> Reply-To: jhallen@wpi.wpi.edu (Joseph H Allen) Organization: Worcester Polytechnic Institute, Worcester ,MA Lines: 30