Reddit: SafeD - The Safe Subset of D

Charles D Hixson charleshixsn at earthlink.net
Sun Mar 23 14:14:07 PDT 2008


Walter Bright wrote:
> Charles D Hixson wrote:
>> PPS:  When talking about casts or type conversions, please make it 
>> explicit whether the same bit pattern is maintained. I often read 
>> those descriptions, and realize that I can't figure out exactly what 
>> is happening.  With C I was always certain that I was just telling the 
>> compiler to think about the same piece of memory differently, and that 
>> nothing actually changed.
> 
> 
> int i = 3;
> double d = (double)i;
> 
> changes the bit pattern in C (as well as in D)
O...K...
So I didn't understand them in C, either.  I'd been 
understanding them as a temporary substitute for a union for 
doing unsafe conversions.  (And avoiding them as much as 
possible.  Apparently just as well.)


More information about the Digitalmars-d-announce mailing list