[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: FALSE == 1



On Fri Oct 20, 2000 at 03:05:39PM -0700, Karl M. Hegbloom wrote:
> >>>>> "Nick" == Nick Holgate <holgate@debian.org> writes:
> 
>     Nick> I have just spent couple of hours tracking down a problem with a minor patch
>     Nick> I made to the boot-floppies sources. It turns out that I made the assumption
>     Nick> that the macro FALSE would be defined as 0, when in fact dbootstrap.h
>     Nick> defines it as ((int) 1) and the corresponding TRUE definition as ((int) 0).
>     Nick> I have not checked, but could other boot-floppies hackers have also made the
>     Nick> same invalid assumption.
> 
>  I think this was done deliberately.  It's using shell semantics, not
>  C semantics for TRUE and FALSE.
> 
>  TRUE is 0 + No error has occured.
> 
>  FALSE is != 0 + the number indicates an error code.
> 
>  Otherwise, perhaps there has to be an error code global variable?

The historical perspective:

    About 1 year ago I got permission from the author of sash to use some of
    his code in busybox.  Busybox, at that time, did not use TRUE or FALSE at
    all.  Sash used TRUE and FALSE with shell semantics (i.e. backwards from
    what most C code expects).  So along with the sash code came the backwards
    #defines.  Since they were there, they then got used for other things with
    the result that busybox now needs about 1 day worth of work to reverse
    things.

    Arguably, I should have fixed up the sash code to use C semantics before
    including it.  But then hindsight is 20/20,

 -Erik

--
Erik B. Andersen   email:  andersee@debian.org
--This message was written using 73% post-consumer electrons--



Reply to: