On Sun, Oct 11, 2009 at 4:36 PM, Peter Stuge <[email protected]> wrote: >> if (CONFIG_FOO) { >> } >> >> which fit in more nicely than the separate layer of preprocessing >> statements > > Why is this more nice? Since it's not really common I would be > surprised (and slightly annoyed) to not find CONFIG_FOO declared in > any source code. OK, the prefix helps, but it still looks a little > strange to me.
It's way more nice. First off, if your compiler optimizes, then it can just optimize this out, getting the same effect as #ifdef. Second, it really removes the problems of #iifdef. Sometimes people forget to #define something and the #ifdef fails, which is not what they might have expected :-). Sometimes something might be defined to 0, meaning don't use it, but people test it with #ifdef, oops. I have seen all these scenarios. Third, it makes the CONFIG variables consistent. It's a pain when some config variables have variable (e.g. base addresses and baud rates and so on) and others do not. The whole #ifdef thing happened 30 years ago. It's obsolete. We can now set and test cpp variables, and we might as well. Rob Pike has articulated this argument far better than I can, and I'm on vacation in Santa Fe today :-), so I'll only say this: let's leave it with cpp variables having values. I don't want to see us go back to #ifdef. thanks ron -- coreboot mailing list: [email protected] http://www.coreboot.org/mailman/listinfo/coreboot

