Definition of “atomic object”

  • A+

In standard jargon of C and C++, the phrase "atomic object" means "object of atomic type," does it not?

No standard will explicitly define every two-word phrase, so one does not fault the C and C++ standards for omitting explicit definition of this one. Nevertheless, when I read in the C++17 standard (draft here), sect. 4.7.1(4), that "all modifications to a particular atomic object M occur in some particular total order, called the modification order of M"—and when the standard repeatedly employs similar language to delimit ever more precise logic for concurrency—I would like to be sure that I am not inadvertently misunderstanding.

Do I assume correctly that the phrase "atomic object" means

  • object of atomic type?

The only plausible alternative I can imagine would be that the phrase instead meant

  • properly aligned object small enough that hardware could handle it atomically.

Which is it, please?

(Note: I tag this question both C and C++ because, when it comes to atomics, the two standards use almost identical language. For this reason, an expert in either language can answer as far as I know. If for some reason I am mistaken, then please remove the C tag and retain the C++.)

Reference: see also this question, for which my question is preliminary.


In my view atomicity - strictly speaking - does not apply to types or objects, it applies to operations, i.e. you can say an operation is atomic or not.

However when you say "atomic object" you actually mean an object whose public interface exposes only atomic operations, i.e. all operations you can do with that object are atomic.

In C and C++ it may be that they are defined the other way around: first define atomic objects and then define atomic operations in terms of atomic objects.

The C++ has the standard std::atomic<T> class template which fits the above descriptions.


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: