Odd trivia question involving && and ,
Chris Torek
chris at mimsy.umd.edu
Thu May 3 16:13:19 AEST 1990
In article <1990May2.181709.8988 at dasys1.uucp> aj-mberg at dasys1.uucp
(Micha Berger) writes:
>Do these peices of source code produce significantly different object
>code?
The answer to the question you asked is `yes', but the answer to the
question you probably meant to ask is `no':
> E1 &&
> E2,
> E3;
(vs)
> if (E1) {
> E2;
> E3;
> }
Since `&&' binds tighter than `,', the first fragment is equivalent to
if (E1) E2;
E3;
If you change the first fragment to
E1 && (E2, E3);
then the answer is `no, not unless you try to get the value of the
exression'---at least, not in any decent compiler.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at cs.umd.edu Path: uunet!mimsy!chris
More information about the Comp.lang.c
mailing list