Skip to content

Why does Code Virtualizer report nested macros when none are nested?

Compiler optimization may have removed a VIRTUALIZER_END marker. VM markers are dummy code, so some compilers remove an end marker placed after a return statement or at the end of a function.

Do not place VIRTUALIZER_END after a return statement. If the compiler removes a marker placed at the end of a function, move it earlier or disable optimization for that function.

For example, in C/C++:

#pragma optimize("", off)

void MyFunction(void)
{
    VIRTUALIZER_START

    // your code

    VIRTUALIZER_END
}

#pragma optimize("", on)