Visual Studio 2022 version 17.5 introduced experimental support for C11 atomics through <stdatomic.h>. To use it in C source, select C11 mode or later and enable /experimental:c11atomics. C++ atomics were already available through <atomic> and std::atomic; the notable 17.5 addition was the C11 interface.
What version of Visual Studio 2022 added C11 atomics?
The initial experimental support arrived in Visual Studio 2022 version 17.5. Microsoft announced it for Visual Studio 2022 17.5 Preview 2 on December 13, 2022. The Microsoft release notes describe the addition as initial experimental support for C11 atomic primitives in <stdatomic.h>.
How do you enable stdatomic.h in MSVC?
- Use a Visual Studio 2022 MSVC toolset version 17.5 or later.
- Compile the source in C11 mode or later with
/std:c11or the applicable later C language mode. - Add
/experimental:c11atomicsto the compiler options.
Microsoft documents the feature as experimental and requires the experimental switch in C11 mode or later. Check the project’s selected platform toolset and compiler command-line options if the header or atomic declarations are unavailable.
How do C11 atomics differ from C++ atomics?
| Use case | Header and syntax | Compiler mode and option | Status |
|---|---|---|---|
| C11 source | <stdatomic.h>, _Atomic(T), or _Atomic |
/std:c11 or later, plus /experimental:c11atomics |
Experimental initial support; lock-free atomics only |
| C++ source | <atomic> and std::atomic |
C++ standard mode appropriate to the library feature | C++ atomic implementation predated the C11 addition |
Microsoft’s C++ standard library had implemented the C++ side of C atomics, from proposal P0943R6, since Visual Studio 2022 17.1. Microsoft says the C11 implementation uses the same ABI as the STL’s C++ atomics, enabling correctly ordered atomic operations across shared C and C++ headers when the code is valid in both languages. See the C++ Team Blog announcement and Microsoft’s C++ standard library feature status.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitches#1 Best Overall
What are the limitations of MSVC’s initial C11 atomics?
The initial implementation supported only lock-free atomics. Microsoft said locking atomics would be added in a future release, and that __STDC_NO_ATOMICS__ would remain defined until locking atomics were implemented. Do not infer from the presence of the header that every C11 atomic type or operation is available for cases requiring locks.
Are MSVC atomics lock-free?
For the initial C11 implementation in the 17.5 announcement, support was limited to lock-free atomics; locking atomics were not yet implemented. More generally, “atomic” does not automatically mean “lock-free.” Microsoft’s [<atomic> reference](https://learn.microsoft.com/en-us/cpp/standard-library/atomic?view=msvc-170) defines a lock-free type as one whose operations do not use mutex locks.
Atomicity and memory ordering are related but distinct. Atomicity means an operation is indivisible: another thread’s atomic operation on the same object observes its state before or after that operation, rather than a partially updated value. The memory_order setting specifies visibility and ordering constraints between operations; it does not, by itself, promise lock-free execution.
Quick Recap
Best Value
What should you check before using the feature?
- Compiler version: Confirm that the project uses MSVC 17.5 or later, rather than relying only on the Visual Studio IDE version.
- Language: C11 code uses
<stdatomic.h>and_Atomic; C++ code uses<atomic>andstd::atomic. - Options: C11 atomics require C11 mode or later and
/experimental:c11atomicsfor the initial implementation. - Requirements: If your program needs atomic operations that may use locking, the initial C11 implementation does not provide them.
- Interoperability: The shared ABI supports C/C++ interoperability for code written validly in both languages, but does not make the C and C++ spellings interchangeable in every source file.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.

