473,811 Members | 3,956 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:19 9409.
- 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 1544
Trent Buck <NO************ @bigpond.com> wrote in
news:20******** *************@h arpo.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:19 9409.
- 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
8543
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.4 installer for windows. Now I have problems to compile python extension that some packages
2
1728
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 = ~(p1 ^ p2); // ^ is the AND operator in logic notation
8
3219
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
8501
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 lack of C 99 compliant compilers. Is this just a lame excuse for back-sliding?
48
4965
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 David Daniels where he said that probably the VS2003 toolkit will be used for Python 2.5 again. However, even before the release of Python 2.5, I cannot seem to find many retailers around here that still carry Visual Studio 2003, and some were a...
87
3839
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 allowed in assignments, and I would like the compiler to check for C syntax instead of C++ syntax. Besides that, ease of use for a beginner and basic debugging capabilities are important. Suggestions are welcome.
6
3684
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 { Version_t *version /* OPTIONAL */; AlgorithmIdentifier_t signature; Name_t issuer; Time_t thisUpdate; struct Time *nextUpdate /* OPTIONAL */;
0
1423
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 predicate. Note the most compact way is to use Lambda notation and anonymous functions, the first way shown below. The most 'intuitive' way is to 'hard code' the predicate using a predicate method, the second way shown below, but the best way (for me)...
159
7138
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
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10656
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10397
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10413
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10138
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5565
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3027
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.