With msvc, is there an equivalent to gcc’s “__builtin_return_address”?
I’m looking to find the address of the calling function, 1 level deep.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
__ReturnAddress
From MSDN:
Note that on some platforms, the result could be misleading due to tail folding – the compiler might have your inner function return 2 levels deep. This can commonly occur for code like this:
The compiler could generate code so DoSomethingSpecial returns directly to the caller of DoSomething.
Also, the return address is not trustworthy-enough to make security decisions, see here.