Placing #ifdefs inside or outside of source files #452
Closed
Description
Mentioned in #451, I'd like to look at the possibility of moving a large portion of the
#ifdef FEATURE_ENABLE
#include "feature.h"
feature();
#endif
code blocks to having a wrapper on the entire feature.c
file to disable it, and include dummy functions where necessary (they likely won't be needed that often).
Pros:
- disable via
config.h
instead ofMakefile
(doesn't really cleaning, easier/more straight-forward to modify, all being c) - cleaner code, no giant
#ifdef
s around calls (somethingaction.c
is suffering from) - no
#ifdef
s required inkeymap.c
Cons:
- is the compiler smart enough to exclude things without affecting memory size?
- code is less clear, since functions will always be called (unsure if they're doing anything)
feature.c
will always be compiled (I believe) - does this have an effect on compile time?
Comments are welcome!