Quantcast
Channel: GCC is non-conforming? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Lundin for GCC is non-conforming?

$
0
0

Pre-C11 compilers and libraries will not define __STDC_NO_THREADS__, nor will post-C11 ones with support for threading. So a correct check needs to look like this:

#if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)  #include <threads.h>

Otherwise older versions of the compiler/library will not work. In your case, you seem to be using Mingw under Windows, in which case the non-compliant Microsoft CRT is used (it does not conform to C99 and beyond).

Later versions of gcc using later versions of libc seem to work correctly with the original code.

Please note that gcc is not to be regarded as a conforming implementation unless you compile with -std=c17 -pedantic-errors. I don't think it matters in this specific case.


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>