<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi cfe-dev,<div class=""><br class=""></div><div class="">C++11 onwards specs the non-member functions atomic_load and atomic_load_explicit as taking the atomic<T> by const (potentially volatile) pointer. C11, in its infinite wisdom, decided to drop the const, and C17 will fix this with <a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_459" class="">DR459</a> (the current draft forgot to fix B.16, but that’s not the normative part).</div><div class=""><br class=""></div><div class="">I suggest we allow passing const _Atomic(T)* in all versions of C. It seems silly to special-case C11’s semantics because they allow strictly less code to work. I’d usually just post these patches, but the not-quite-correct C11 semantics made me think twice.</div><div class=""><br class=""></div><div class="">This doesn’t affect C++ (unless you try to use stdatomic.h in C++ which… you shouldn’t…).</div><div class=""><br class=""></div><div class="">I would change the following (independently, they don’t need to synchronize-with):</div><div class=""><ul class=""><li class="">clang’s lib/Headers/stdatomic.h implements these as #define to the __c11_* equivalent, which are builtins with custom typecheck. Fix the typecheck.</li><li class="">Additionally, libc++ defines the __c11_* functions in include/atomic for the sake of GCC compatibility. Fix their declaration.</li></ul></div><div class=""><br class=""></div><div class="">It seems GCC already doesn’t require const: <a href="https://godbolt.org/g/4Q2vre" class="">https://godbolt.org/g/4Q2vre</a></div><div class=""><br class=""></div><div class="">Thoughts?</div></body></html>