Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!slacvm!doctorj From: DOCTORJ@SLACVM.SLAC.STANFORD.EDU (Jon J Thaler) Newsgroups: comp.lang.c Subject: Re: Evaluation of if's Message-ID: <91156.095107DOCTORJ@SLACVM.SLAC.STANFORD.EDU> Date: 5 Jun 91 17:51:07 GMT References: <1991Jun4.233928.5185@athena.mit.edu> Distribution: usa Organization: Stanford Linear Accelerator Center Lines: 17 In article <1991Jun4.233928.5185@athena.mit.edu>, scs@adam.mit.edu (Steve Summit) says: >> [...discussion of this expression deleted...] >> if ( (i=1) == (i=2) ) >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." When must a compiler issue warnings or other error messages? It seems to me that since this expression is recognizable as an error, a compiler 'ought' to warn the user. As far as I can tell, this does not seem to be required by the standard.