Newsgroups: comp.lang.c Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!bloom-picayune.mit.edu!news From: scs@adam.mit.edu (Steve Summit) Subject: Re: Evaluation of if's Message-ID: <1991Jun4.233928.5185@athena.mit.edu> Sender: news@athena.mit.edu (News system) Reply-To: scs@adam.mit.edu Organization: Thermal Technologies, Cambridge, MA References: Distribution: usa Date: Tue, 4 Jun 91 23:39:28 GMT Lines: 19 In article fpb@ittc.wec.com (Frank P. Bresz) writes: > if ( (i=1) == (i=2) ) > >Is somebody wrong or is the behavior undefined? >Personal opinion: I think the behaviour is undefined by K&R anyway I can't >say for ANSI. Of course it's undefined. (It contains two side effects not separated by a sequence point.) Given that the behavior is undefined, I'd say it's fairly pointless to catalog the behavior of available compilers. As Kernighan and Ritchie point out, and I am fond of quoting, "if you don't know how they are done on various machines, that innocence may help to protect you." The comp.lang.c frequently-asked questions list has a bit to say about undefined order of evaluation. Did you check it first? Steve Summit scs@adam.mit.edu