Code Styling Tips

From eLinux.org
Revision as of 22:01, 30 May 2008 by Flakeman2 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

[1]

And the section of the old [2] article starting with "No ifdefs in .c Code", about how to move #ifdefs into headers so the functions aren't littered with them. Just a thought...

Personally, I tend to have symbols #defined to a constant 0 or 1 depending on whether or not a function is enabled, and then just use if(SYMBOL) as a guard and let the compiler's dead code eliminator take it out for me at compile time (because if(0) {blah;} shouldn't put any code in the resulting .o file with any optimizer worth its salt. Borland C for DOS managed simple dead code elimination 20 years ago...)