[Bug 3097] BB making easily-fixed non-portable assumptions

Rich Felker dalias at aerifal.cx
Tue Feb 8 19:01:56 UTC 2011


On Tue, Feb 08, 2011 at 12:02:26AM +0100, Joakim Tjernlund wrote:
> >
> > On Mon, Feb 07, 2011 at 11:13:03PM +0100, Joakim Tjernlund wrote:
> > > > On Mon, Feb 07, 2011 at 08:10:48PM +0100, Joakim Tjernlund wrote:
> > > > > Relying on undef -> 0 is dangerous. Much better build with -Wundef
> > > > > and fixup the errors.
> > > >
> > > > How is this dangerous? Undef -> 0 is part of the C language at least
> > > > since C89, and perhaps before that. Nobody is using pre-ANSI C
> > > > compilers, and I guarantee if you try to compile Busybox with a
> > > > pre-ANSI compiler, you will encounter much bigger problems than the
> > > > preprocessor failing to convert undefined symbols to 0 when evaluating
> > > > #if...
> > >
> > > code sometime assumes/needs a symbol to be defined to some
> > > value or it is an error. Undefined syms redefined to 0
> > > may break such code silently.
> >
> > I think you're trying to apply some general dogmatic rule without
> > understanding it. These two preprocessor directives:
> >
> > #if defined(FOO) && (FOO > BAR)
> > #if FOO > BAR
> 
> Assume BAR = -1, then do it again.

As you can see, BAR is not -1 but 200809L. Like I said, you are
applying a general dogmatic rule that is useless here.

Rich


More information about the busybox mailing list