>>> Lots of #if ENABLE in general that could be if (ENABLE) instead. >> In general a static >> function should be inlineable and optimizable away with gcc 4.x. > >should be != is. gcc is still sometimes rather stupid. >#if FOO is a surefire way to DEFINITELY exclude some code. >if (FOO) (actually some more complex constructs with &&, ||, >etc) confuse gcc.
If anyone wants my opinion, I greatly dislike using if(FOO) with the expectation that the compiler will eliminate the code. I expect if() to be associated only with run-time decisions, just as #if is with compile-time decisions. In fact, if cc _were_ able to eliminate great gobs of code I'd even expect a warning to that effect, as it is likely that that is NOT what I as author intended. While a well-behaved compiler can/should be able to do the job, it cannot do it under all conditions where it is necessary. (Consider a C source that is also compilable under VMS. No way the maze of #includes could even be handled without #if, much less compiling its way past VMS-specific grubbage. Don't like VMS as an example? Then how about Windoze/DoS?) So, given that you have to use #if anyway for at least some code configuration jobs, why not use it for everything? After all, the C preprocessor is one of the big reasons that C and all its derivatives are so popular. It works, it is simple, and it's fairly unambiguous. Is it really the intent, after all, that BB _only_ be usable with gcc 4.x, presumably on Linux? How parochial! -- Jim _______________________________________________ busybox mailing list [email protected] http://busybox.net/cgi-bin/mailman/listinfo/busybox
