Clarification for 7-4-3

Moderators: david ward, misra cpp

Post Reply
Posts: 3
Joined: Sat Mar 18, 2017 4:32 pm
Company: Minho University

Clarification for 7-4-3

Post by mikearmagedon » Tue Mar 28, 2017 7:52 pm

Rule 7-4-3 states that "... assembly instructions shall be encapsulated and isolated in either assembler functions or C++ functions.".

Does assembler functions refers to assembly directives (.func and .endfunc) used in a .S file or it refers to C++ functions that encapsulate the assembly instructions?

Is the example compliant?

Code: Select all

.global foo
.func foo

Code: Select all

extern "C" {
  void foo();

int main(void) {

misra cpp
Posts: 157
Joined: Mon Jun 02, 2008 1:55 pm
Company: MISRA

Re: Clarification for 7-4-3

Post by misra cpp » Mon Jul 10, 2017 11:31 am

Your code example is compliant, as the assembler code is not regarded as part of the C program. The rule relates to inline assembly code
Posted by and on behalf of
the MISRA C++ Working Group

Post Reply

Return to “6.7 Declarations (C++)”