Ensuring that assembly language code is encapsulated and isolated aids portability. Where assembly language instructions are needed, they shall be
encapsulated and isolated in either assembler functions or C++ functions.
Noncompliant code example
void fn ( void )
{
DoSomething ( );
asm ( "NOP" ); // Noncompliant, asm mixed with C/C++ statements
DoSomething ( );
}
Compliant solution
void Delay ( void )
{
asm ( "NOP" ); // Compliant, asm not mixed with C/C++ statements
}
void fn ( void )
{
DoSomething ( );
Delay ( ); // Compliant, Assembler is encapsulated
DoSomething ( );
}