C++ Logo


Advanced search

Subject: atomic_ref::required_alignment usefulness
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2020-02-09 08:15:44


As specified in N4849, atomic_ref<T>::required_alignment is:

   The alignment required for an object to be referenced by an atomic
   reference, which is at least alignof(T).

This wording does not give provision as to whether this alignment is
strict enough so that atomic_ref<T> is lock-free (provided that it can
be lock-free at all). At the same time, atomic_ref<T> does not provide a
constant for the alignment that guarantees lock-free operations (again,
provided that they can be lock-free). Let's call this missing constant

Is my understanding correct? If so, it seems like required_alignment is
rather useless, as there seems to be no reason to make it anything other
than alignof(T). Why is recommended_alignment, which is much more
useful, missing?


STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups