Newsgroups: comp.lang.c Path: utzoo!sq!msb From: msb@sq.sq.com (Mark Brader) Subject: Re: Can analysis detect undefined expressions? Message-ID: <1991Jun23.060337.26567@sq.sq.com> Organization: SoftQuad Inc., Toronto, Canada References: <14489.2861906B@stjhmc.fidonet.org> Date: Sun, 23 Jun 91 06:03:37 GMT Lines: 20 > > (j = ((i=1) == (i=2))) == (j = ((i=3) == (i=4))) > 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. On the other hand, I for one would welcome with open arms a compiler that made those checks at compile time and exercised its right to *refuse to compile it* in the first place. (As has been pointed out, this becomes arbitrarily difficult if the expression involves things like indirection. I don't care. I just want the compiler to reject a[i++] = i, x = a[i++]+b[i++], the above expression, and other such cases that *are* easily diagnosed. Even Saber-C (3.0.1) misses these, unless maybe I have some option set wrong.) -- Mark Brader "It is impractical for the standard to attempt to SoftQuad Inc., Toronto constrain the behavior of code that does not obey utzoo!sq!msb, msb@sq.com the constraints of the standard." -- Doug Gwyn This article is in the public domain.