Rules and Limitations
-
The return statement is not permitted in a naked function. However, you can return an int by moving the return value into the EAX register before the RET instruction.
-
Structured exception handling constructs are not permitted in a naked function, because the constructs must unwind across the stack frame.
-
The setjmp run-time function cannot be used in a naked function, because it too must unwind across the stack frame. However, use of the longjmp run-time function is permitted.
-
Use of the _alloca function is not permitted in a naked function.
-
To ensure that no initialization code for local variables appears before the prolog sequence, initialized local variables are not permitted at function scope. In particular, the declaration of C++ objects is not permitted at function scope. There can, however, be initialized data in a nested scope.
-
Frame pointer optimization (the /Oy compiler option) is not recommended, but it is automatically suppressed for a naked function.