On 10/10/20 8:04 AM, Marc Nieper-Wißkirchen wrote:
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L &&
!defined (__STD_NO_ATOMICS__)
I am asking because there may be non-C11 compilers that nevertheless
understand _Atomic.
I suggest not worrying about this problem until we run into it. Quite possibly
any actual problem will be something like "_Atomic can be used for most things,
but not for feature X" in which case we'll likely want the more fine-grained
check anyway. Until we discover actual problems we can get by with
#if __STDC_VERSION__ < 201112 || defined __STD_NO_ATOMICS__
which is a cleaner way of writing the negative of the above test. These days
there should be no reason to check whether __STDC_VERSION__ is defined,
generally it's clearer to use "<" instead of ">=" so that textual order reflects
numeric order, and the parens after "defined" are better omitted.