Xref: csiph.com comp.arch:33298 Newsgroups: comp.arch Path: csiph.com!xmission!news.snarked.org!border2.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: Fri, 29 Jan 2016 23:25:46 GMT References: Organization: Kithrup Enterprises, Ld. X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Lines: 19 In article , Terje Mathisen wrote: >IMHO the only sane implementation of that would be a locked increment >operation, i.e. either > > LOCK INC [a] So, things like LOCK were basically beyond the language standards of yesteryear. This was because they weren't written with threads or other such fun things. In a modern language standard (aka C++ 14 for example) can can get the lock with: atomic_fetch_add I don't believe the language standand will ensure LOCK on ++a. I could be wrong about that, it just takes a single requirement someplace to do that. See: http://en.cppreference.com/w/cpp/atomic/atomic/fetch_add for a complete (simple) example.