Replacing std.math raw pointer arithmetic with a union type

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed May 17 11:57:47 PDT 2017


On 5/17/2017 8:30 AM, Stefan Koch wrote:
> 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.


Thanks for the clarification.

Hence, removing such casts in Phobos would break it in CTFE, rather than fix it.


More information about the Digitalmars-d mailing list