object.opEquals return type

Janice Caron caron800 at googlemail.com
Sun Feb 24 08:11:01 PST 2008


On 24/02/2008, Lars Ivar Igesund <larsivar at igesund.net> wrote:
> Walter belive that an int is more efficient.

The way I see it, the problem is that bool has a defined width. It
shouldn't have, because bool is special.

One possible solution would be to have explicit types bool8 and
bool32, with "bool" meaning "either bool8 or bool32, at the compiler's
discretion".

The compiler would only need very simple rules to choose which to use
(e.g. if function parameter or function return or local variable, use
bool32, else use bool8), and allow either to implicitly and losslessly
cast to the other.

I think that would work. It would allow the programmer's intent to be
specified in the code, but preserve efficiency at all levels.



More information about the Digitalmars-d mailing list