I want to do something in C99 one way, otherwise to perform it another way. What is the #define
to check for?
#ifdef C99 ... #else ... #endif
Which One Should You Use: Is There A or Is There Any? We must use 'a' with singular countable nouns and 'any' with uncountable nouns. We use 'is' with both singular countable nouns and uncountable nouns. Remember, uncountable nouns do have countable forms of measurement.
We use there is for singular and there are for plural. There is one table in the classroom. There are three chairs in the classroom. There is a spider in the bath.
Use there is when the noun is singular (“There is a cat”). Use there are when the noun is plural (“There are two cats”).
In English grammar we use “there is” or “there are” to talk about things we can see and things that exist. We use “there is” for singular and uncountable nouns, and we use “there are” for plural countable nouns. See our page on English nouns for more information about countable and uncountable nouns.
There is not an specific #define
value. Just check __STDC_VERSION__
and define it yourself! ;-)
#if __STDC_VERSION__ >= 199901L /* C99 code */ #define C99 #else /* Not C99 code */ #endif #ifdef C99 /*My code in C99 format*/ #else /*My code in C99 format*/ #endif
EDIT: A more general snippet, from here. I've just changed the defined names, just in case you'll use them a lot on the code:
#if defined(__STDC__) # define C89 # if defined(__STDC_VERSION__) # define C90 # if (__STDC_VERSION__ >= 199409L) # define C94 # endif # if (__STDC_VERSION__ >= 199901L) # define C99 # endif # if (__STDC_VERSION__ >= 201112L) # define C11 # endif # endif #endif
#if __STDC_VERSION__ == 199901L /* C99 */ #else /* not C99 */ #endif
Change ==
to >=
if you want to test for C99 and later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With