[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: --enable-tiny option
From: |
Paul Eggert |
Subject: |
Re: --enable-tiny option |
Date: |
31 Oct 2003 16:32:02 -0800 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Robert Millan <address@hidden> writes:
> busybox is one of the most unportable programs I ever seen.
It's pretty squished, yes.
> I don't think the #if directives would add much clutter. I don't
> know coreutils sources myself, but I believe that most of the code
> in them are GNU extensions.
Yes, probably. But I'm afraid that the extensions normally won't be
big blocks of code; they'll be scattered throughout the code. Lots of
ifdefs will give the coreutils maintainer fits.
> (could you give a more accurate estimation on that?)
It's nontrivial to estimate, I'm afraid.
> If my assumption is correct, the #if directive addition would mostly look
> like:
>
> #ifndef TINY
> [ bulk of code for extra features ]
> #endif
> [ code for common code to comply with POSIX ]
I suggest defining TINY (or better perhaps its antonym, EXTRAS) as
boolean constants, so that you can write this:
if (EXTRAS)
code_for_extra_features ();
as this will be easier to read than ifdefs. You can also use "#if
EXTRAS" if that's necessary, but typically "if (EXTRAS)" nests nicer
and has better compile-time checking.
My suggestion is to pick one nontrivial program ("cat", say) and try
to do just that one, to see if the coreutils maintainer has a heart
attack with the result.