ISO standards macro are rejected by g++

Zack Weinberg zack@wolery.cumb.org
Tue Apr 25 12:19:00 GMT 2000


On Tue, Apr 25, 2000 at 09:55:26PM +0200, Thierry Vignaud wrote:
> g++ (both 2.95.x and egcs snapshots) rejects __file__ __FUNCTION__ and
> __PRETTY_FUNCTION__ whithout -fpermissive, which don't comply to the
> standard.

In my tests, g++ (either 2.95 or snapshot) does not reject
__FUNCTION__ even with an explicit -pedantic.  This is wrong.
__FUNCTION__ and __PRETTY_FUNCTION__ are GNU extensions, and as such
g++ should reject them in pedantic mode.

__file__ is not and has never been a predefined identifier/macro.
__FILE__ should work just fine.  You might be thinking of __func__,
which is in the new C standard but not in the C++ standard (although
the next C++ standard will probably add it).  Both 2.95 and snapshot
g++ accept __func__, again, without complaint even with -pedantic.

zw


More information about the Gcc-bugs mailing list