C compiler lies about c11 support

The C compiler accepts the option '-std=c11' and responds by defining the define token '__STDC_VERSION__' = 201112 which thereby claims C11 support. Additionally, it DOES NOT define '__STDC_NO_THREADS__' and therefore the include headers <threads.h> and <stdatomic.h> should exist but they dont. The compiler is promising C11 threads, condition variables, ... support but does NOT provide it. This is NOT a link time problem, it is a compile time issue.

I didnt specifiy but I need a work around because I promised to write some code that it turns out I cant easily deliver without a lot of extra work. I need a solution ASAP but unfortunately I expect that I am just plain screwed for the next year or two.

I think you're stuck, sorry. Please do file a bug about our non-compliance. (FWIW, <stdatomic.h> is present in Xcode 7, but <threads.h> still isn't.)

I was having problems with -std=c11 too so I switched to -std-gnu11 and it worked for _Generic and stdatomic.h. Strangely I switched back to -std=c11 and it worked. However threads.h , and unicode support are not available as of this date. If you really need unicode support you have the option of gcc.

if you're compiling for OSX why don you use gcc?

Is there any updates? I still can't find <threads.h> and no STDC_NO_THREADS definition when creating command-line tool using C.

But I still wonder if there is any plan for shipping supports for C11 threads?

We can’t talk about The Future™ here on DevForums. We already have a bug on file requesting C11 threads support (r. 71334589), but if this is important to your I recommend that you file your own bug requesting it, with an explanation as to why.

I believe there are various open source libraries that implement C11 threads on top of pthreads, so you could use one of those in the meantime.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

C compiler lies about c11 support
 
 
Q