I was reading the gnu coding standards the other day. One suggestion therein that I quite liked is to (where system headers permit) change:

#if OPTION
 // some code here
#endif

to
 if (OPTION) {
     // some code here
  }

Their rational is that:
* The compiler then checks all code paths for parsability, scoping issues, variable renames ettc.
* The resulting code should be identical with any reasonable optimising compiler.
* It makes software with many options easier to maintain.


Thoughts?
Rob



Reply via email to