CTFE limitation on reinterpreting cast
Rambutan
s56l6zk0w at mozmail.com
Fri Oct 2 16:57:41 UTC 2026
On Thursday, 1 October 2026 at 06:44:55 UTC, Walter Bright wrote:
>> That way placing cast pointers to globals in global struct
>> initializers would be legal, as it is in C.
>
> I understand your point, and it has merit. But I am
> apprehensive in allowing CTFE to make bad pointers, even if
> they are not dereferenced. Perhaps consider a union instead?
Thank you. May I suggest that allowing CTFE to potentially make
bad pointers but not realize their badness is a natural extension
of the ability to write @system code in D to get the job done
when necessary?
Perhaps you might consider that allowing reinterpreting casts of
pointers in CTFE but disallowing their indirect use in CTFE is
effectively a runtime decision about @system code.
More information about the Digitalmars-d
mailing list