Re: Feature request - a macro defined for GCC

Top Page

Reply to this message
Author: Denys Vlasenko
Date:  
To: gcc
CC: x z, gcc
Subject: Re: Feature request - a macro defined for GCC
On Tuesday 01 July 2008 07:33, x z wrote:
>
> I would like to see that GCC define a macro in the case it is being used to compile a program. Currently there is a __GNUC__ macro defined by the GNU C preprocessor CPP. That does not suit the need. As the CPP Manual says: __GNUC__ is "defined by all GNU compilers that use the C preprocessor".


My monitor is not wide enough for your lines.

> It seems to imply that any (non-GNU) compiler that
> uses the GNU C preprocessor would also have __GNUC__ defined.


Did you test this theory?

> According to their respective manuals, Intel C++ Compiler
> and Portable C Compiler also pre-define __GNUC__, possibly
> because they use the GNU CPP.


It's their fault that they lie to the user.

> Therefore, the fact that __GNUC__ is defined does not necessarily mean the GCC compiler proper is being used. There is a need for a macro that definitely confirms that GCC is being used. (It is another matter if another complier deliberately misleads people by defining the same macro.) And I hope that macro can be documented in the GCC Manual.


--
vda