---
title: Implementability of P0943’s C++ stdatomic.h
audience: LEWG, SG1
document: p4230r0
date: 2026-05-12
reply-to:
  - "Hans Boehm"
paper-type: proposal
---

There has been a lot of discussion arguing that the C++23 spec essentially forces ODR violations. by implementing atomics as both a struct/class (in C++) and a scalar (in C) IMO, that depends on your perspective. If you view C code as also C++ code, then ODR violations in a combined C with C++ program make sense. This is the common view of C types in C++.

It is fundamentally not what wg21.link/P0943 does. We treat C and C++ as different languages trying to access the same data structures in memory. The only way in which it builds on the relationship between C and C++ is by observing that we have types that should have the same binary representation on both sides, and the syntax is similar enough that we can provide some definitions (in C++'s version of stdatomic.h) that essentially allow the same syntax to work in either language.. In my view, claiming an ODR violation here is similar to saying that Java's new FFM facility for accessing C memory introduces ODR violations. (See [here](https://docs.oracle.com/en/java/javase/21/core/foreign-function-and-memory-api.html#GUID-FBE990DA-C356-46E8-9109-C75567849BA8), if you care) We agree there may be issues here for whole program optimization across both C and C++.
