TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - C Coding Standard
Search

Guideline:  12.3#7Checked automatically with code checker

Synopsis:Use functions in preference to function-like macros unless performance is a genuine issue.
Language:C
Severity Level:5
Category:PREPROCESSING


Description:

The function-like macro

#define PLUS(x,y) x + y

could better be defined as

int plus(int x, int y) { 
  return x + y; 
}

The main reason for this is that the code in the latter case is properly type-checked by the compiler.