From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1ff5003422436e4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-11 17:45:43 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swiss.ans.net!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: dewar@cs.nyu.edu (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: Easily-Read C++? Date: 11 Oct 1994 14:52:10 -0400 Organization: Courant Institute of Mathematical Sciences Message-ID: <37emsq$smg@gnat.cs.nyu.edu> References: <1994Oct7.153254.29848@swlvx2.msd.ray.com> <374uke$8mo@delphi.cs.ucla.edu> <37bno4$ko4@gnat.cs.nyu.edu> <1994Oct11.090047.9190@sei.cmu.edu> NNTP-Posting-Host: gnat.cs.nyu.edu Date: 1994-10-11T14:52:10-04:00 List-Id: Robert (Firth), you didn't look at my question quite carefully enough. Of course it can be the case that ++c clobbers a value stored by someone else, but I asked the following: is it permissible for ++c to STORE a different value from what it returns? Now of course on all machines, as illustrated by your second code example (which is really the only possibility on all RISC machines, and is the best code on all modern machines), it is possible to generate code so the answer is NO x := x + 1; (x left in a register) (use the value in the register) I would expect that this code is what is generated by most C compilers. The only possible exception is on CISC machines with increment memory or add to memory instructions, when in fact it certainly can answer YES to my question, as illustrated by the first example. Reading the C standard clearly does not answer my question, so we must presume that the two sequences of code have quite a different effect. Note that we ought to assume that the variable involved is volatile, and you would expect that a volatile variable would be accessed in a comprehensible canonical style (this is certainly true in Ada), but the ++c and c++ constructs definitely mean that even if c is volatile you don't know how often it is read and written. I certainly agree with your parting thought! (how can anyone write parallel code in C that is portabl).