svn commit: trunk/busybox/init

Mike Frysinger vapier at gentoo.org
Thu Dec 27 21:40:38 UTC 2007


On Tuesday 25 December 2007, Denys Vlasenko wrote:
> On Tuesday 25 December 2007 04:30, vapier at busybox.net wrote:
> > Author: vapier
> > Date: 2007-12-24 20:30:14 -0800 (Mon, 24 Dec 2007)
> > New Revision: 20683
> >
> > Log:
> > convert #if to if -- let gcc optimize away dead code for us
>
> Thanks.
>
> I worry that sometimes gcc is too dumb.
> #if/#endif is dead sure method to disable something,
> hoping for compiler/linker to be smart is less reliable.

for 1/0 things, i think it's safe to rely on the compiler being safe.  for 
more extravagant things, if you want to bank on the side of unsafe compiler, 
i understand.

> Although I agree that #ifdef forest tend to clutter up things
> (for example, dreaded httpd.c), and I'd like such cases to be
> cleaned up.
>
> Bit in these cases:
>
> #ifdef BUT_RUN_ACTIONS_ALREADY_DOES_WAITING
> # define BRAADS 1
> #else
> # define BRAADS 0
> #endif
>
> replacing two #directives with five doesn't seem to be an improvement
> in readability.

it isnt merely a readability change.  it helps prevent bitrot by making sure 
all code gets compiled.  we've had problems in the past where uncommon 
configuration combinations would go untested and have build errors.  this 
pretty much prevents that completely.  i'll take a bloat from two lines to 
five for this, especially considering the size of code inside of that ifdef.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.busybox.net/pipermail/busybox-cvs/attachments/20071227/8ebcb1af/attachment-0002.pgp 


More information about the busybox-cvs mailing list