Posts: 4
Threads: 3
Joined: Feb 2006
Reputation:
0
What are the possible scenarios in which Rule 2.1 will be violated?
Rule allows for Macros, C-functions and Assembly functions.
If any assembly code is used directly it will be reported as an compliler error for undefined identifier etc.
<t></t>
Posts: 632
Threads: 18
Joined: Jan 2006
Reputation:
1
C statements and assembler statements should not co-exist in a function unless the assembler is encapsulated in a macro.
The following example violates this rule.
Code:
static void foo ( void )
{
asm { \"CLI\" };
foobar();
asm { \"SEI\" };
}
Posted by and on behalf of the MISRA C Working Group
Posts: 4
Threads: 3
Joined: Feb 2006
Reputation:
0
Do the following code snippets violate Rule 2.1?
1. macro encapsulation:
#pragma asm
MOV A,B
....
....
#pragma endasm
2.function call
asm(\"CLI\");
or
move(\"MOV A,B\");
Also statements like
asm{ \"CLI\" };
seem to be compiler specific.
What are the other possible ways of violating this rule (compiler specific/not specific).
Also, please can you give examples where the rule is not violated.
<t></t>
Posts: 632
Threads: 18
Joined: Jan 2006
Reputation:
1
MISRA-C meeting 23-8-2006
The previous reply by lv is consistent with our views.
Posted by and on behalf of the MISRA C Working Group