¿Le resultó útil esta página?
Sus comentarios sobre este contenido son muy importantes. Háganos saber su opinión.
¿Tiene comentarios adicionales?
Caracteres restantes: 1500
Exportar (0) Imprimir
Expandir todo
Expandir Minimizar
Importante Es posible que este documento no represente los procedimientos recomendados para el desarrollo actual. Puede que los vínculos a las descargas y otros recursos ya no sean válidos. Encontrará aquí la versión que se recomienda en la actualidad.

_AddressOfReturnAddress

Microsoft Specific

Provides the address of the memory location that holds the return address of the current function. This address may not be used to access other memory locations (for example, the function's arguments).


void * _AddressOfReturnAddress();

Intrinsic

Architecture

_AddressOfReturnAddress

x86, x64

Header file <intrin.h>

When _AddressOfReturnAddress is used in a program compiled with /clr, the function containing the _AddressOfReturnAddress call is compiled as a native function. When a function compiled as managed calls into the function containing _AddressOfReturnAddress, _AddressOfReturnAddress might not behave as expected.

This routine is only available as an intrinsic.

// compiler_intrinsics_AddressOfReturnAddress.cpp
// processor: x86, x64
#include <stdio.h>
#include <intrin.h>

// This function will print three values:
//   (1) The address retrieved from _AddressOfReturnAdress
//   (2) The return address stored at the location returned in (1)
//   (3) The return address retrieved the _ReturnAddress* intrinsic
// Note that (2) and (3) should be the same address.
__declspec(noinline)
void func() {
   void* pvAddressOfReturnAddress = _AddressOfReturnAddress();
   printf_s("%p\n", pvAddressOfReturnAddress);
   printf_s("%p\n", *((void**) pvAddressOfReturnAddress));
   printf_s("%p\n", _ReturnAddress());
}
 
int main() {
   func();
}
0012FF78
00401058
00401058

Adiciones de comunidad

AGREGAR
Mostrar:
© 2015 Microsoft