workaround for closure problem needed

BCS ao at pathlink.com
Thu Dec 27 10:44:11 PST 2007


Reply to Jérôme,

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> BCS wrote:
> 
>> OTOH (WARNING: TOTAL HACK) if you want to go one step cheaper; state
>> is 32bits, the same as a void*.
>> 
> Doesn't work on 64 bits platforms!
> 

Actually it should work. You Just get 32bits of junk passed around that is 
ignored. The reverse is the one that wont work (ulong+64bit works but ulong+32bit 
fails)

To be on the safe side the union should have:

static assert((void*).sizeof >= Union.sizeof);

and the other struct should have:

static assert(0 == Struct.sizeof);

> Jerome
> - --
> +------------------------- Jerome M. BERGER ---------------------+
> |    mailto:jeberger at free.fr      | ICQ:    238062172            |
> |    http://jeberger.free.fr/     | Jabber: jeberger at jabber.fr   |
> +---------------------------------+------------------------------+
> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.7 (GNU/Linux)
>> 
>> iD8DBQFHc1led0kWM4JG3k8RAsc9AJ43BIXYijvUF18cIBOVIZA1vvdO8QCeJb04
>> /12efoBUeayhetlzXHSfkTY=
>> =1kBl
> -----END PGP SIGNATURE-----




More information about the Digitalmars-d-learn mailing list