Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!ucla-cs!maui.cs.ucla.edu!jon From: jon@maui.cs.ucla.edu (Jonathan Gingerich) Newsgroups: comp.lang.c Subject: Re: Can analysis detect undefined expressions? Message-ID: <1991Jun21.165226.15192@cs.ucla.edu> Date: 21 Jun 91 16:52:26 GMT References: <14489.2861906B@stjhmc.fidonet.org> Sender: usenet@cs.ucla.edu (Mr. News Himself) Organization: UCLA Computer Science Department Lines: 19 Nntp-Posting-Host: maui.cs.ucla.edu In article <14489.2861906B@stjhmc.fidonet.org> Dave.Harris@f14.n15.z1.fidonet.org (Dave Harris) writes: >In a message of , Dale Worley (1:114/15) writes: >> An extended example so that I can think clearly here: >> (j = ((i=1) == (i=2))) == (j = ((i=3) == (i=4))) >> Assumedly, i can end up as 1,2,3, or 4. j should be 0. The grouping is >such >> that i=4, i=2, i=3, i=1 won't happen without breaking any laws. right? > >Sorry to belabor this yet again, but there is no requirement in Ansi C > >that i have one of the values 1, 2, 3, or 4. The effect of this > >statement is "undefined", which means that the implementation can do > >*anything*, including giving i the value 100, core dumping, or > >starting World War III. Ditto for j. The mere fact that none of > >these actions are mentioned in the statement is irrelevant. >Not arguing that the result is undefined as you say. But.... >I for one would quickly scrap any compiler that went to the additional work of >embedding code to yield a value of anything other than 1,2,3 or 4 for i. It >would mean the compiler would have to detect the undefined statement first >before it could even do this. ... Not if it were setting i on 4 CPUs run in parallel! Jon.