View previous topic :: View next topic |
Author |
Message |
Nimesh Srivastava Beginner
Joined: 22 Jul 2003 Posts: 13 Topics: 8
|
Posted: Fri Nov 18, 2005 2:26 am Post subject: Function Name - C/C++ |
|
|
Hi,
I want to access the function name of the calling function in the called function without passing any information in the parameters or as global variables. I need this for changing my Legacy Application's error handling routine.
For ex.
a()
{
...
// calls function b
b(2);
}
b(int l)
{
...
// print the name of function from which it was called
// in this case the calling function is 'a'
}
Thanks in advance...
Cheers
Nimesh |
|
Back to top |
|
|
DaveyC Moderator
Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Thu Jan 05, 2006 9:08 am Post subject: |
|
|
Can't be done, you need to use the __FUNCTION__ macro and pass it through. The best way to do this is by using a macro or inline function. _________________ Dave Crayford |
|
Back to top |
|
|
|
|