g++ (3.3) bug?

J

JustSomeGuy

the macro __FUNCTION__
returns the name of the constructor rather than the name of the destructor
in when used in the destructor.

test::test()
{
cerr << __FUNCTION__ << endl; // should output test
}
test::~test()
{
cerr << __FUNCTION__ << endl; // should output ~test?, but outputs test.
}

I'm using g++ 3.3 on MAC OS X 10.3
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
 
D

David Harmon

On Sun, 18 Apr 2004 20:01:27 GMT in comp.lang.c++, "JustSomeGuy"
the macro __FUNCTION__
returns the name of the constructor rather than the name of the destructor
in when used in the destructor.

If you believe that something is a compiler bug, please avoid posting it
in comp.lang.c++.

The obvious place for this would be gnu.g++.bug
 
R

Rob Williscroft

JustSomeGuy wrote in in
comp.lang.c++:
the macro __FUNCTION__
returns the name of the constructor rather than the name of the
destructor in when used in the destructor.

test::test()
{
cerr << __FUNCTION__ << endl; // should output test
}
test::~test()
{
cerr << __FUNCTION__ << endl; // should output ~test?, but outputs
test.
}

I'm using g++ 3.3 on MAC OS X 10.3
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)

Ask this in news://gnu.gcc.help , __FUNCTION__ isn't a standard
macro so it does what the gcc team say it does, and they may say
that in ctor's/dtor's it returns the class name.

Rob.
 
C

Christopher Benson-Manica

Rob Williscroft said:
Ask this in news://gnu.gcc.help , __FUNCTION__ isn't a standard
macro so it does what the gcc team say it does, and they may say
that in ctor's/dtor's it returns the class name.

__FUNCTION__ isn't standard, but C99 specifies the __func__ predefined
identifier, which I believe is #define'd to be __FUNCTION__ for OP's
implementation. I would be interested to know whether __func__ made
it into standard C++ as well.
 
K

Kevin Goodsell

Christopher said:
__FUNCTION__ isn't standard, but C99 specifies the __func__ predefined
identifier, which I believe is #define'd to be __FUNCTION__ for OP's
implementation. I would be interested to know whether __func__ made
it into standard C++ as well.

Not yet. C++ hasn't added any new features since the first standard in 1998.

-Kevin
 
M

Michiel Salters

Kevin Goodsell <[email protected]> spoke thus:

(moving to comp.std.c++)



Does "not yet" mean that it's planned for the next version of the C++
standard?

There is some obvious discussion about the meaning of __func__ in C++
special cases - the destructor mentioned before, namespaces - but it is
covered by the desire to create a viable subset of C99 and C++0x. So
s/planned/considered/ and you're right.

Regards,
Michiel Salters
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top