CPP predicates for compiler extensions

T

Trent Buck

I'm trying to find CPP predicates that allow conditional compilation
based on the compiler's standard / features / extensions. So far I have
determined that, for GCC,
- __STRICT_ANSI__ implies -ansi.
- ! __STDC_VERSION__ implies -std=c89 or -std=gnu89.
- 199409 == __STDC_VERSION__ implies -stdc=iso9899:199409.
- 199901 == __STDC_VERSION__ implies -std=c99 or -std=gnu99.

I'd like to be able to
- distinguish between cXX and gnuXX (i.e. are there extensions?).
- check support for variadic macros.
- check support for statement expressions.
- check support for the typeof operator

Can it be done? I don't want to take the autoconf route of attempting
to compile test programs. I currently only care about GCC, and maybe
Solaris.

Thanks in advance,
-trent
 
M

Mark A. Odell

I'm trying to find CPP predicates that allow conditional compilation
based on the compiler's standard / features / extensions. So far I have
determined that, for GCC,
- __STRICT_ANSI__ implies -ansi.
- ! __STDC_VERSION__ implies -std=c89 or -std=gnu89.
- 199409 == __STDC_VERSION__ implies -stdc=iso9899:199409.
- 199901 == __STDC_VERSION__ implies -std=c99 or -std=gnu99.

I'd like to be able to
- distinguish between cXX and gnuXX (i.e. are there extensions?).
- check support for variadic macros.
- check support for statement expressions.
- check support for the typeof operator

Can it be done?

Not with C. You'll need to find a newsgroup that discusses the compiler(s)
you care to use to perform this preprocessor check with.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top