[previous] MISRA C:2012  Dir-4.9:  (Advisory) [next] A function should be used in preference to a function-like macro where they are interchangeable

Amplification:

This guideline applies only where a function is permitted by the syntax and constraints of the language standard.

Example Code:


#include "misra.h"
#include "m3cmex.h"

#define  MAX( A, B )   ( ( ( A ) > ( B ) ) ? ( A ) : ( B ) )    /* 3453 */
#define  MMAX          ( 14 + 32 )
#define  HELLO         10


extern int16_t dir_0409( void )
{
   return 1;
}


QAC messages that encompass this guideline:

3453 A function could probably be used instead of this function-like macro.



(c) The Motor Industry Research Association, 2012
QA C Source Code Analyser 8.1.2
MISRA C:2012 Compliance Module 1.0
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents