473,499 Members | 1,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CPP predicates for compiler extensions

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
Nov 14 '05 #1
1 1520
Trent Buck <NO************@bigpond.com> wrote in
news:20*********************@harpo.marx:
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.

--
- Mark ->
--
Nov 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

188
8227
by: Ilias Lazaridis | last post by:
I'm a newcomer to python: - E01: The Java Failure - May Python Helps? http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553 - I've download (as suggested) the python...
2
1711
by: Thong Nguyen | last post by:
I wrote my own Predicate class for .NET 1.1 which allowed composite predicates using operator overloading... for example: Predicate p1 = {...}; Predicate p2 = {...}; Predicate p1andp2 =...
8
3196
by: madhu.mys | last post by:
Hi, According to you, Which is the best C++ compiler for windows ? Which compiler is least buggy and generate Optimized code ?
233
8103
by: E. Robert Tisdale | last post by:
I have access to a wide variety of different platforms here at JPL and they all have pretty good C 99 compilers. Some people claim that they have not moved to the new standard because of the...
48
4878
by: meyer | last post by:
Hi everyone, which compiler will Python 2.5 on Windows (Intel) be built with? I notice that Python 2.4 apparently has been built with the VS2003 toolkit compiler, and I read a post from Scott...
87
3697
by: H. | last post by:
I am a student taking a machine structures class in a university, which includes learning C. I am looking for a good freeware or shareware compiler which can be used in a "C only" mode. C++ isn't...
6
3654
by: James H. Newman | last post by:
I am playing with some code that has been automatically generated from ASN.1 data specification found in RFC 3280. One of the structures generated reads as follows: typedef struct TBSCertList {...
0
1401
by: raylopez99 | last post by:
Inspired by Jon, I did a demo prorgram showing three ways to declare predicates, in for example the "FindIndex" and "FindLastIndex" methods of Lists, but in general you can do this for any...
159
6948
by: bernard | last post by:
howdy! please recommend a good c compiler. - should be small - should be fast - should come with a good ide - should be inexpensive i am using windows os.
0
7009
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7178
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5475
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3103
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
302
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.