Union copy
"Luís
"Luís
Wed Oct 23 11:19:12 PDT 2013
On Wednesday, 23 October 2013 at 18:07:37 UTC, Ali Çehreli wrote:
> If D's unions are like C's and C++'s, then it is not defined
> what happens when accessing members of the union that are not
> active.
>
> Either the anonymous struct or 'd' above is active, so only
> that member can be accessed.
Is it not valid to initialize a double with a bit pattern that
you read from somewhere (e.g. disk)? (reinterpret cast, I
guess?). Something like this(?):
void main()
{
long srcL = 0x7ff7a50200000000;
double* srcD = cast(double*) &srcL;
double dst = *srcD;
writef("src: %x\n", srcL);
writef("dst: %x\n", *cast(long*) cast(void*) &dst);
}
If this is valid, the question seems to be why the
quiet/signaling flag is changed.
More information about the Digitalmars-d
mailing list