__ ReturnAddress
From MSDN:
The built-in _ReturnAddress instruction address in the calling function, which will be executed after control returns to the caller
Note that on some platforms, the result may be misleading due to tail bending - the compiler may have an internal function returning 2 levels. This can usually happen for the code:
int DoSomething() { return DoSomethingSpecial(); }
The compiler can generate code, so DoSomethingSpecial returns DoSomething directly to the caller.
In addition, the return address is not trustworthy - enough to make security decisions, see here .
source share