Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!newstop!male!yavin!mike_s From: mike_s@EBay.Sun.COM (Mike "The Claw" Sullivan) Newsgroups: comp.sys.amiga.programmer Subject: Re: ANOTHER SAS C BUG Message-ID: Date: 31 Mar 91 06:27:54 GMT References: <1991Mar31.035009.13183@csis.dit.csiro.au> Sender: news@male.EBay.Sun.COM Lines: 22 In <1991Mar31.035009.13183@csis.dit.csiro.au> dave@csis.dit.csiro.au (David Campbell) writes: >/* Here is some source which demonstrates a bug in the SAS C > compiler */ > *ptr = '\001' + *ptr++; No, the problem is that the evaluation order of the right and left sides of an assignment expression is unspecified. You are assuming that it determines the storage location on the left (*ptr), then computes the right hand side (and advances ptr). That does not happen to be what SAS C is doing. You should avoid side-effects like ++ in assignment expressions if you use the operand on the other side. Mike -- Mike Sullivan Internet: msullivan@EBay.Sun.COM Sun Education UUCP: ..!sun!yavin!msullivan Software Course Developer Compuserve: 75365,764 "The old Maxwell Smart silhouette on the window shade trick. That's the