Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!inferno.mpx.com.au!news.ci.com.au!news.vision.net.au!news.mel.aone.net.au!news.mel.connect.com.au!esmeralda.access.net.au!news.netspace.net.au!news.mira.net.au!inquo!news.uoregon.edu!news.u.washington.edu!uw-beaver!cornellcs!newsstand.cit.cornell.edu!portc01.blue.aol.com!chi-news.cic.net!news.synet.net!imdave From: imdave@synet.net (Dave Bodenstab) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: Compiler bug? Date: 7 Nov 1996 20:02:49 GMT Organization: Dave Bodenstab's home machine Lines: 30 Message-ID: <55tf99$6b5@garuda.synet.net> References: <55p7ck$r2l@csgrad.cs.vt.edu> <3280F04E.4D5A@cococo.net> NNTP-Posting-Host: dial47.synet.net In article <3280F04E.4D5A@cococo.net>, Kelley <kelley@cococo.net> wrote: >Tommy Johnson wrote: >> >> This program doesn't work as I think it should. On line 10, b is not >> incremented between the first and second b++'s, though it is correct >> after the entire expression. >> >> <snip> >> >> a=c[b++]|((c[b++])<<8); This statement violates standard C. Consult the C standards for exact details, but the bottom line is that there is no rule to define *when* each `b++' is evaluated. >> printf("should be 0x3412 %4x\n",a); >> } > >Not sure if it is a bug or not, since the expression (to the best of my >recollection) with a post increment operator isn't evaluated until the >next expression, but try this out on line 10: > >a=c[--b] | ((c[++b])<<8); This is also illegal. Dave Bodenstab imdave@synet.net