[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: detecting an iso C99 environment



Warren Turkal <wturkal@cbu.edu> writes:

> How do I detect an ISO C99 environment via C preproccessor directives?
> Warren

In C99 __STDC_VERSION__ is defined as 199901L.  Thus, something like
this should work:

#ifdef __STDC_VERSION__
    #if (__STDC_VERSION__ == 199901L)
        /* okay */
    #else
        /* __STDC_VERSION__ is defined but not 199901L */
        #error This compiler is not C99-compliant!
    #endif
#else
    /* __STDC_VERSION__ is not defined */
    #error This compiler is not C99-compliant!
#endif

You can read more about that in the C99 standard, ANSI/ISO/IEC
9899-1999 in paragraph 6.10.8.
-- 
Aaron Isotton

http://www.isotton.com/
My GPG Public Key: http://www.isotton.com/gpg-public-key



Reply to: