opEquals needs to return bool

Janice Caron caron800 at googlemail.com
Fri May 16 14:46:07 PDT 2008


On 16/05/2008, BCS <ao at pathlink.com> wrote:
> > > Bools are bytes, while ints are 4 bytes, so sometimes ints are
> > > managed faster.
> > >
> > So why not just make bool a 4-byte value?  Using an integer to
> > represent a boolean operation is just silly.
>
>  Or pad them to 4 bytes where you can (local variable).

Honestly, I think I would be happy with a four-byte bool, in almost
all circumstances.

For those rare cases where space is an issue, there could be a second
type, bool8, implicitly castable to and from bool, but you wouldn't
use that by default; you'd only use it in structs where you needed to
pack stuff tight.



More information about the Digitalmars-d mailing list