g++ (3.3) bug?

Discussion in 'C++' started by JustSomeGuy, Apr 18, 2004.

  1. JustSomeGuy

    JustSomeGuy Guest

    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)
    JustSomeGuy, Apr 18, 2004
    #1
    1. Advertising

  2. JustSomeGuy

    David Harmon Guest

    On Sun, 18 Apr 2004 20:01:27 GMT in comp.lang.c++, "JustSomeGuy"
    <> wrote,
    >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
    David Harmon, Apr 18, 2004
    #2
    1. Advertising

  3. JustSomeGuy wrote in news:r8Bgc.161060$Pk3.87406@pd7tw1no 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.
    --
    http://www.victim-prime.dsl.pipex.com/
    Rob Williscroft, Apr 18, 2004
    #3
  4. Rob Williscroft <> spoke thus:

    > 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.

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
    Christopher Benson-Manica, Apr 19, 2004
    #4
  5. Christopher Benson-Manica wrote:

    > __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
    --
    My email address is valid, but changes periodically.
    To contact me please use the address from a recent posting.
    Kevin Goodsell, Apr 19, 2004
    #5
  6. Kevin Goodsell <> spoke thus:

    (moving to comp.std.c++)

    > Christopher Benson-Manica wrote:


    >> __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.


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

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.

    ---
    [ comp.std.c++ is moderated. To submit articles, try just posting with ]
    [ your news-reader. If that fails, use mailto: ]
    [ --- Please see the FAQ before posting. --- ]
    [ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
    Christopher Benson-Manica, Apr 19, 2004
    #6
  7. (Christopher Benson-Manica) wrote in message news:<c6155c$4ni$>...
    > Kevin Goodsell <> spoke thus:
    >
    > (moving to comp.std.c++)
    >
    > > Christopher Benson-Manica wrote:

    >
    > >> __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.

    >
    > 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

    ---
    [ comp.std.c++ is moderated. To submit articles, try just posting with ]
    [ your news-reader. If that fails, use mailto: ]
    [ --- Please see the FAQ before posting. --- ]
    [ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
    Michiel Salters, Apr 20, 2004
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John

    Re: BUG? OR NOT A BUG?

    John, Sep 20, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    536
  2. RedEye
    Replies:
    2
    Views:
    571
    Jason Kester
    Dec 13, 2005
  3. Michel Joly de Lotbiniere

    Bug Parade Bug 4953793

    Michel Joly de Lotbiniere, Nov 30, 2003, in forum: Java
    Replies:
    4
    Views:
    631
    Michel
    Dec 2, 2003
  4. DarkSpy
    Replies:
    4
    Views:
    876
    tom_usenet
    Jun 27, 2003
  5. Steve Holden
    Replies:
    1
    Views:
    386
    Behrang Dadsetan
    Jul 2, 2003
Loading...

Share This Page