Newsgroups: comp.arch Path: csiph.com!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!news.glorb.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!kithrup.com!mrs From: mrs@kithrup.com (Mike Stump) Subject: Re: The freedom that give us C++ and C Message-ID: Date: Sat, 6 Feb 2016 09:27:08 GMT References: <65188d0c-9b58-4f48-b7c0-24fc5cb02912@googlegroups.com> Organization: Kithrup Enterprises, Ld. X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Lines: 27 X-Received-Bytes: 1587 X-Received-Body-CRC: 1082408717 Xref: csiph.com comp.arch:33505 In article , Nick Maclaren wrote: >In article <65188d0c-9b58-4f48-b7c0-24fc5cb02912@googlegroups.com>, >MitchAlsup wrote: >>> Another example that is enough to make one blench is: >>> volatile int a; >>> x = ++a; >>> or even: >>> ++a; >> >>The programmer should get what he deserves, in this case. But unfortunately >>the standard did not specify that 20 lashes was the proper interpretation of >> >>> x = ++a; > >Right. You can probably guess what I teach :-) > >So the programmer is getting convicted and punished for breaking >a law that isn't actually on the statute books? Justice in action. No, the meaning of the code above, is, exactly as stated in the standard. What isn't stated, is that this is a fully atomic lockless primative on all hardware. Why? Because not all hardware can even do that locklessly. It turns out that only way to get atomic primatives, is to use the atomic primatives. Next.