*BSD News Article 83788


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!news.nacamar.de!fu-berlin.de!irz401!orion.sax.de!uriah.heep!news
From: j@uriah.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Compiler bug?
Date: 28 Nov 1996 23:06:09 GMT
Organization: Private BSD site, Dresden
Lines: 24
Message-ID: <57l5t1$hr0@uriah.heep.sax.de>
References: <55tf99$6b5@garuda.synet.net> <57hsae$cpm@uwm.edu>
Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
NNTP-Posting-Host: localhost.heep.sax.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: knews 0.9.6
X-Phone: +49-351-2012 669
X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F  93 21 E0 7D F9 12 D6 4E

bacon@alpha1.csd.uwm.edu (Jason Wayne Bacon) wrote:

> >  >>         a=c[b++]|((c[b++])<<8);

> The behaviour of this statement *is* well defined.

No, it isn't.

> The | operator evaluates left to right, so the operations
> *should* occur in the followign order:

No.  You're confusing expression evaluation with associativity.

There are only two exceptions in C where the standard requires a
particular sequence of evaluation: the comma operator (obvious), and
the && and || operators (so you can say ``if (ptr && *ptr ...)'').
For everything else, only the associativity is defined.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)