| View previous topic :: View next topic |
| Author |
Message |
Christopher Benson-Manica Guest
|
Posted: Mon May 16, 2005 2:17 pm Post subject: Name of current function |
|
|
C99 defines the manifest constant __func__, which expands to the name
of the current function. The C++ Builder 4 documentation pretty
clearly indicates that neither __func__ nor the GNU version
__FUNCTION__ are supported. Is this manifest constant or an
equivalent present in later versions of C++ Builder?
--
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.
|
|
| Back to top |
|
 |
Ed Mulroy [TeamB] Guest
|
Posted: Mon May 16, 2005 4:40 pm Post subject: Re: Name of current function |
|
|
C++ Builder provides __FILE__ and __LINE__ With them you not only
know the function, you know on which line within the function.
.. Ed
| Quote: | Christopher Benson-Manica wrote in message
news:4288ab71 (AT) newsgroups (DOT) borland.com...
C99 defines the manifest constant __func__, which expands to
the name of the current function. The C++ Builder 4
documentation pretty clearly indicates that neither __func__
nor the GNU version __FUNCTION__ are supported. Is this
manifest constant or an equivalent present in later versions of
C++ Builder?
|
|
|
| Back to top |
|
 |
Christopher Benson-Manica Guest
|
Posted: Mon May 16, 2005 5:39 pm Post subject: Re: Name of current function |
|
|
Ed Mulroy [TeamB] <dont_email_me (AT) invalid (DOT) com> wrote:
| Quote: | C++ Builder provides __FILE__ and __LINE__ With them you not only
know the function, you know on which line within the function.
|
Yes, I know about those; they're fine for debugging, but for display
purposes the aforementioned __FUNC__ macros would be most desirable.
--
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.
|
|
| Back to top |
|
 |
Andrue Cope [TeamB] Guest
|
Posted: Tue May 17, 2005 7:51 am Post subject: Re: Name of current function |
|
|
Christopher Benson-Manica wrote:
| Quote: | Yes, I know about those; they're fine for debugging, but for display
purposes the aforementioned FUNC macros would be most desirable.
|
You have it. It's called __FUNC__. We use it in our error handler.
--
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
|
|
| Back to top |
|
 |
Christopher Benson-Manica Guest
|
Posted: Tue May 17, 2005 12:37 pm Post subject: Re: Name of current function |
|
|
Andrue Cope [TeamB] <no.spam (AT) not (DOT) a.valid.address> wrote:
| Quote: | You have it. It's called __FUNC__. We use it in our error handler.
|
I've been told that it was introduced with C++ Builder 5;
unfortunately we are still using version 4.
--
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.
|
|
| Back to top |
|
 |
Alisdair Meredith [TeamB] Guest
|
Posted: Tue May 17, 2005 3:23 pm Post subject: Re: Name of current function |
|
|
Christopher Benson-Manica wrote:
| Quote: | C99 defines the manifest constant func, which expands to the name
of the current function. The C++ Builder 4 documentation pretty
clearly indicates that neither func nor the GNU version
FUNCTION are supported. Is this manifest constant or an
equivalent present in later versions of C++ Builder?
|
This is not a part of C++. There was a proposal to add it to the next
version, although I have heard no feedback on that so it may have died.
Maybe we should push it ourselves <g> [I think this is a great
feature, as we use it ourselves]
If you are using the Boost libraries, you can use the Boost macro
BOOST_FUNCTION_NAME that expands the compiler-defined function-name
macro where avaiable, or an empty string literal otherwise. That's
what we use, even though most our code is only compiled under BCB.
AlisdairM(TeamB)
|
|
| Back to top |
|
 |
|