How can i check for /experimental:c11atomics flag inside code?

Adam Satko 20 Reputation points
2024-10-09T13:45:25.4433333+00:00

Hi Microsofters,

I have a problem when compiling C code for more than 2 weeks to catch whether /experimental:c11atomics is set for msvc inside code. I tried checking for __STDC_NO_ATOMICS__ macro but in vain. Could anyone please give me any tip how to check for that?

Thanks a lot in advance :)

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,761 questions
{count} votes

Accepted answer
  1. Minxin Yu 12,011 Reputation points Microsoft Vendor
    2024-10-10T12:35:43.4366667+00:00

    Hi, @Adam Satko

    According to the blog:

    Note that we still define __STDC_NO_ATOMICS__ so if your build system is testing for that you will need to add a special case or change to checking if compiling a translation unit including <stdatomic.h> succeeds.

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.