Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Odd trivia question involving && and , Keywords: && , if Message-ID: <24137@mimsy.umd.edu> Date: 3 May 90 06:13:19 GMT References: <1990May2.181709.8988@dasys1.uucp> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 33 In article <1990May2.181709.8988@dasys1.uucp> aj-mberg@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@cs.umd.edu Path: uunet!mimsy!chris