null assignment to bit variable

Chris Miller chris at dprogramming.com
Mon Aug 14 18:43:24 PDT 2006


On Mon, 14 Aug 2006 21:22:54 -0400, Peter Thomassen  
<info at peter-thomassen.de> wrote:

> Hi,
>
> the following doesn't work:
>
> bit test;
> test = null;
> I understand that this is not possible, but coming from the PHP world,  
> I'm
> looking for a way to define that "test" hasn't got a value yet, not even
> true or false.
>
> Is that possible? Is there a workaround?
>
> Thanks!
> Peter


Perhaps bool/bit isn't even what you want.

enum Foo: byte
{
    None,
    True,
    False,
}

Foo f = Foo.None;

and this requires no heap allocation or extra storage.



More information about the Digitalmars-d mailing list