Actions

EmSys

CCoding Style - Function Macros

From EdWiki

Revision as of 09:30, 23 June 2015 by Jshankar (Talk | contribs) (1 revision imported: EdWiki -- Emsys pages from Shukra)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Function Macros

  • There is a tendency among C-Programmers to write macros instead of functions for short computations that will be executed frequently.
  • The reason is performance: a macro avoids the overhead of a function call.
  • With modern machines and compilers, the drawbacks of function macros outweighs their benefits.
  • Function macros cause more problems than they solve.
  • If you insist on using function macros, be careful.