Fork us on GitHub Follow us on Facebook Follow us on Twitter

Version 2 (modified by Vojtech Horky, 11 years ago) (diff)

Fix formatting

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