Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a #define for C99?

Tags:

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 
like image 688
klynch Avatar asked Jan 22 '10 08:01

klynch


People also ask

Is there any or A?

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.

Is there or are there examples?

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.

Is there or are there which is correct?

Use there is when the noun is singular (“There is a cat”). Use there are when the noun is plural (“There are two cats”).

Is there are there grammar?

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.


2 Answers

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 
like image 122
Khelben Avatar answered Oct 28 '22 09:10

Khelben


#if __STDC_VERSION__ == 199901L /* C99 */ #else /* not C99 */ #endif 

Change == to >= if you want to test for C99 and later.

like image 37
Alok Singhal Avatar answered Oct 28 '22 09:10

Alok Singhal