Rules and Limitations for Naked Functions

OverviewHow Do I

The following rules and limitations apply to naked functions:

  • The return statement is not permitted.

  • Structured Exception Handling constructs are not permitted because they must unwind across the stack frame.

  • For the same reason, any form of setjmp is prohibited.

  • Use of the _alloca function is prohibited.

  • 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 may, 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.

  • You cannot declare C++ class objects at the function lexical scope. You can, however, declare objects in a nested block.