Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!sdrc!thor!scjones From: scjones@thor.UUCP (Larry Jones) Newsgroups: comp.lang.c Subject: Re: Is something wrong with the compiler ? Message-ID: <189@thor.UUCP> Date: 28 Sep 90 21:53:35 GMT References: <884@gtenmc.UUCP> <1990Sep26.175948.8232@zoo.toronto.edu> Organization: SDRC, Cincinnati Lines: 18 In article , burley@world.std.com (James C Burley) writes: > > a = ( int )(( unsigned ) ( a = ~0 ) >> 1 )); > > Hmm, I thought it was ok -- doesn't "=" serve as a "sequence point" or > some such thing, and since the lhs of the outer = is so simple it can't > be "evaluated" before the rhs has been, and the rhs contains the other > =, one is guaranteed the latter = is performed before the former, right? No, '=' is not a sequence point. The question in this case is not when the lhs gets evaluated, but when the actual storage of the rhs into the lhs is done. A compiler would be completely within its rights to store the final result into a and then overwrite it with ~0. ---- Larry Jones UUCP: uunet!sdrc!thor!scjones SDRC scjones@thor.UUCP 2000 Eastman Dr. BIX: ltl Milford, OH 45150-2789 AT&T: (513) 576-2070 Yep, we'd probably be dead by now if it wasn't for Twinkies. -- Calvin