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.
const
. So I would assume atomic object means "an atomic-qualified object". That is, declared as (C11)_Atomic int blondie;
with the_Atomic
type qualifier. – Miniumstd::atomic<int>
template fluff. – Minium<stdatomic.h>
. And probably other places — there are lots of mentions ofatomic
in the standard linked to. C18 is very similar, though atomic figure in the changes. – Cyanicstd::atomic
type (at least in C++20). Newstd::atomic_ref
class template makes an object it refers to atomic. … for the lifetime of theatomic_ref
object, the object referenced by*ptr
is an atomic object. Whether such wording is optimal is another question. – Gatehouse