wiki:CodingTips

Version 3 (modified by Jiri Svoboda, 9 years ago) ( diff )

Coding Tips

Preprocessor defines, macros, inline functions

  • Prefer using enum instead of preprocessor defines for constants
    • Preprocessor defines are only necessary when you are using the constant both in C and assembly sources
  • Prefer using static inline functions instead of preprocessor macros
    • Preprocessor macros are only needed (a) for type polymorphism, (b) if the result needs to be an l-value (R/W accessor)
  • Prefer using regular functions to static inline functions
    • Practically never needed, it is just premature optimization

Other Resources on Good Coding Practices

Note: See TracWiki for help on using the wiki.