__declspec(naked)
Go Up to Keywords, Alphabetical Listing Index
Category
Modifiers (C++), Keyword Extensions, Storage Class Specifiers (C++)
Syntax
__declspec( naked ) declarator
Use of the naked argument suppresses the prologue/epilogue code. Be aware, when using __declspec(naked), that it does not set up a normal stack frame. A function with __declspec(naked) will not preserve the register values that are normally preserved. It is the programmer's responsibility to conform to whatever conventions the caller of the function expects.
You can use this feature to write your own prologue/epilogue code using inline assembler code. Naked functions are particularly useful in writing virtual device drivers.
The naked attribute is relevant only to the definition of a function and is not a type modifier.
Example
This code example defines a function with the naked attribute:
// Example of the naked attribute
__declspec( naked ) int func( formal_parameters )
{
// Function body
}