473,386 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Compiler identification macro?

Is there any known list of compiler identification macros?
I'm using VS 2003, g++ on windows, sun's cc and g++ on solaris. Is it
possible to identify the compiler using macros?
I'm aware of WIN32 being defined, but that's defined on mingw g++ in windows
too.
Is it called compiler identification macros or is there another term I
should search for?

Thanks!
Jul 22 '05 #1
5 4512
Carl Ribbegaardh wrote:
Is there any known list of compiler identification macros?
I'm using VS 2003, g++ on windows, sun's cc and g++ on solaris. Is it
possible to identify the compiler using macros?


It's possible, but exactly what macros you look for differs from system
to system. See, for example:

GCC: Common Predefined Macros (macros defined in every port of GCC)
http://gcc.gnu.org/onlinedocs/gcc-3....fined%20Macros

GCC: System-specific Predefined Macros (how to find system-specific GCC
macros)
http://gcc.gnu.org/onlinedocs/gcc-3....fined%20Macros

Microsoft: Predefined Macros
http://msdn.microsoft.com/library/de...ned_macros.asp

I usually look for _MSC_VER to identify Microsoft compilers.

Since the answer to your question differs from system to system, you'll
have better luck seeking answers on newsgroups devoted to your
platform/compiler (assuming you can't find the answers in the
documentation).

Regards,

Russell Hanneken
rg********@pobox.com
Remove the 'g' from my address to send me mail.
Jul 22 '05 #2

"Carl Ribbegaardh" <ca*********************@hotmail.com> wrote in message
news:c6************@ID-111741.news.uni-berlin.de...
Is there any known list of compiler identification macros?
I'm using VS 2003, g++ on windows, sun's cc and g++ on solaris. Is it
possible to identify the compiler using macros?
I'm aware of WIN32 being defined, but that's defined on mingw g++ in windows too.
Is it called compiler identification macros or is there another term I
should search for?


These should be in the specific documentation for each compiler you are
using. For Digital Mars C++, the correct way to identify it is:

#ifdef __DMC__
// You're running the Digital Mars C++ compiler
#endif

Do not use WIN32, as that specifies the target operating system, and many
diverse compilers target WIN32.

-Walter
www.digitalmars.com free C/C++/D compilers
Jul 22 '05 #3
Użytkownik Carl Ribbegaardh napisał, On 2004-04-30 02:45:
Is there any known list of compiler identification macros?
I'm using VS 2003, g++ on windows, sun's cc and g++ on solaris. Is it
possible to identify the compiler using macros?
I'm aware of WIN32 being defined, but that's defined on mingw g++ in windows
too.
Is it called compiler identification macros or is there another term I
should search for?

http://predef.sourceforge.net/precomp.html
Best
Darek
--
Life sucks, but it's better than the alternative.
Jul 22 '05 #4
Thanks a lot for your help guys!! :-D
Jul 22 '05 #5
On Fri, 30 Apr 2004 10:18:33 +0200, void <chq@nie_spamuj.wp.pl> wrote:
Użytkownik Carl Ribbegaardh napisał, On 2004-04-30 02:45:
Is there any known list of compiler identification macros?
I'm using VS 2003, g++ on windows, sun's cc and g++ on solaris. Is it
possible to identify the compiler using macros?
I'm aware of WIN32 being defined, but that's defined on mingw g++ in windows
too.
Is it called compiler identification macros or is there another term I
should search for?

http://predef.sourceforge.net/precomp.html


Man, I sure wish I'd have known about that page when I was struggling with
this very issue when working on InitUtil. But that was before I'd begun
dabbling in newsgroups, and it never occurred to me I could just ask the
question! So great answer, and equally great question ;-)
-leor
Best
Darek


--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: download BD Software's free STL Error Message Decryptor at:
www.bdsoft.com/tools/stlfilt.html
Jul 22 '05 #6

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

Similar topics

3
by: Paul Sheer | last post by:
I have managed to build Python 2.3.3 with the aCC HP-UX C++ compiler by making a number of one-line changes. (For reasons beyond my control, I am forced to use this compiler and it has no C mode...
7
by: winlinchu | last post by:
Hi! I use Python, and writing some extension modules I think which could be written an C compiler, useful only to compile extension modules (I not think an GCC!!!!), so that the user not have to...
3
by: Sisyphus | last post by:
Hi, Is there anything in the ANSI C standard covering the means by which I can determine the operating system and compiler being used (at the preprocess stage) ? If so, then how might I...
2
by: suresh | last post by:
Hello to you all In my .Net application, I want to import document images (Tiff images), having same format, in a batch, For e.g. I have a document folder containing mixed images like...
55
by: Steve | last post by:
I have to develop several large and complex C++ hardware test programs that should work under DOS, most likely with 32-bit DOS extender. Development workstation OS would be Microsoft XP. Quite some...
6
by: Michael B Allen | last post by:
Hi, I have a macro that looks like the following: #define MMSG msgno_loc0(LOC0, LOC1) && msgno_mmsg0 which if used in some code like: MMSG("foo=%s", foo);
2
by: talkaboutquality | last post by:
Need to define a macro as, say, #ifdef NEED_FUNCTION foo(x) #else #endif
11
by: David Mathog | last post by:
There was an editing error in one of my programs giving this line (two left parentheses, one right): FD_SET((ncmd->cmd_in_fd,&read_set); When compiled with gcc -Wall -pedantic -stc=c99 ...
27
by: Dave | last post by:
I'm having a hard time tying to build gcc 4.3.1 on Solaris using the GNU compilers. I then decided to try to use Sun's compiler. The Sun Studio 12 compiler reports the following code, which is in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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
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
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...

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.