Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
19.7 no function-like macros
#1
Hi

Two questions about this rule:

1. Have somebody examples short for function-like macros?
2. When is a macro funktion-like?

best regards,
Manni
<t>best regards,<br/>
Manni</t>
#2
ISO defines a function-like macro to be a macro with a parenthesised argument list (which may be empty.)

For example, these are function-like macros

#define abs(x) (((x) >= 0) ? (x) : -(x))
#define pi() 3.14159265

MISRA-C Committee 27.4.2006
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 1 Guest(s)