public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Predefined macros?
@ 2002-09-17 10:06 Dave Williss
  2002-09-17 10:47 ` Martin Dickopp
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Williss @ 2002-09-17 10:06 UTC (permalink / raw)
  To: gcc-help

Are there any predefined macro constants that I can use in ifdefs to
determine which version of gcc is doing the compiling?

I have some code which needs to compile one way if using gcc 3.1 or later
and another way if using 2.95.

 -- Dave Williss
------
Meddle not in the affairs of dragons,
   for you are crunchy and taste good with catsup


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Predefined macros?
  2002-09-17 10:06 Predefined macros? Dave Williss
@ 2002-09-17 10:47 ` Martin Dickopp
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Dickopp @ 2002-09-17 10:47 UTC (permalink / raw)
  To: gcc-help

On Tue, Sep 17, 2002 at 12:05:50PM -0500, Dave Williss wrote:
> Are there any predefined macro constants that I can use in ifdefs to
> determine which version of gcc is doing the compiling?

Yes: __GNUC__ and __GNUC_MINOR__

For example, you can use

#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)

to check for gcc 2.95 or later.

Martin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-17 17:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-17 10:06 Predefined macros? Dave Williss
2002-09-17 10:47 ` Martin Dickopp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).