unsigned policy

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Wed Feb 14 13:01:26 PST 2007


Derek Parnell wrote:
> On Wed, 14 Feb 2007 12:24:59 -0800, Andrei Alexandrescu (See Website For
> Email) wrote:
> 
>> x = y;    // should not work, use x = cast(bool)y or x = y ? 1 : 0
> 
> Did you mean ... 
> 
>   int x;
>   bool y;
>   x = y;    // should not work, use x = cast(int)y or x = y ? 1 : 0

I'm pretty sure that's what he said. His entire block of code was:
---
int x;
if (x) {} // should work: compare x against zero
bool y;
if (y) {} // should work :o)
y = x;    // should not work, use y = (x != 0);
x = y;    // should not work, use x = cast(bool)y or x = y ? 1 : 0
---

So the declarations were still in scope ;).



More information about the Digitalmars-d mailing list