MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Function Name - C/C++

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Nimesh Srivastava
Beginner


Joined: 22 Jul 2003
Posts: 13
Topics: 8

PostPosted: Fri Nov 18, 2005 2:26 am    Post subject: Function Name - C/C++ Reply with quote

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
View user's profile Send private message Send e-mail
DaveyC
Moderator


Joined: 02 Dec 2002
Posts: 151
Topics: 3
Location: Perth, Western Australia

PostPosted: Thu Jan 05, 2006 9:08 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group