Replacing std.math raw pointer arithmetic with a union type

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Wed May 17 08:30:29 PDT 2017


On Wednesday, 17 May 2017 at 15:15:04 UTC, Walter Bright wrote:
> On 5/16/2017 8:02 PM, tsbockman wrote:
>> Such code is verbose, hard to read, and, judging by the bugs 
>> and missing
>> specializations I've found, hard to write correctly. It is 
>> also not compatible
>> with CTFE.
>
> CTFE does support things like:
>
>     double d;
>     int i = *(cast(int*)&d);
>
> as a special case, specifically to support bit manipulation of 
> floating point types.

the special case it supports if cast(uint*)&float;
and cast(ulong*)&double.



More information about the Digitalmars-d mailing list