* function name in printf()
@ 2000-01-20 20:46 Jim Reekes
2000-01-20 20:53 ` David Edelsohn
0 siblings, 1 reply; 2+ messages in thread
From: Jim Reekes @ 2000-01-20 20:46 UTC (permalink / raw)
To: gcc
I'm hoping to create a debugging macro that will have access to the
current function's name. For example, a macro has access to the file and
current line number, but I'd like to know which function I'm currently
in as well. Here's a psuedo-code example:
int FooBar(void)
{
if (Blah() == -1)
printf("Blah failed in \n", __FUNC__);
}
The goal is for the console to display "Blah failed in FooBar".
So the question is, how can I get the symbol name of the current
function?
Jim
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: function name in printf()
2000-01-20 20:46 function name in printf() Jim Reekes
@ 2000-01-20 20:53 ` David Edelsohn
0 siblings, 0 replies; 2+ messages in thread
From: David Edelsohn @ 2000-01-20 20:53 UTC (permalink / raw)
To: Jim Reekes; +Cc: gcc
>>>>> Jim Reekes writes:
Jim> I'm hoping to create a debugging macro that will have access to the
Jim> current function's name. For example, a macro has access to the file and
Jim> current line number, but I'd like to know which function I'm currently
Jim> in as well.
Jim> So the question is, how can I get the symbol name of the current
Jim> function?
Look under "Function Names as Strings" in the C Extensions section
of the GCC documentation which discusses predefines __FUNCTION__ and
__PRETTY_FUNCTION__ -- depending on your need.
David
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-01-20 20:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-20 20:46 function name in printf() Jim Reekes
2000-01-20 20:53 ` David Edelsohn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).