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-12 16:52:50 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: 12 Oct 1994 15:48:58 -0400 Organization: Courant Institute of Mathematical Sciences Message-ID: <37heja$ord@gnat.cs.nyu.edu> References: <371a3p$nos@gnat.cs.nyu.edu> <37bno4$ko4@gnat.cs.nyu.edu> <37eej8$6ie@siberia.gatech.edu> <37en3i$sn7@gnat.cs.nyu.edu> <37goms$r30@siberia.gatech.edu> NNTP-Posting-Host: gnat.cs.nyu.edu Date: 1994-10-12T15:48:58-04:00 List-Id: atomic is certainly listed in my LRM index (we *are* talking Ada 9X here, so I am talking about the 9X 5.0 RM). If you want to talk Ada 83, then pragma Shared serves the purpose of pragma Volatile and pragma Atomic rolled into one (9X sensibly separates these concerns). Obviously if you write: x = x + 1; in either language, you know EXACTLY the meaning if x is atomic and volatile. Sure some other thread can come in, but the exact range of possible effects is well understood, and for example, you can easily implement Djkstra's semaphore algorithm to get coordination of two processes without any explicit system level communication or rendez-vous etc. I am not particularly suggesting you want to do this, but you can. Now if in C, we replace this with: ++x; then we really are not quite sure what that means. No one thinks it means that you can only reference x once, because unless you are on a specialized machine with a fetch-and-add (like the x86), then there is no instruction or instruction sequence that can achieve this in one reference. So, is it the case (remembering that x is volatile and atomic) that there can be at most two references? Well that seems a possible reasonable thing to say, but there is nowhere in the C reference manual that you can deduce such a rule. I trust that makes this clear, or at least clearer.