dmd casts but ldc doesn't, and doesn't work in template in dmdm

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 4 18:12:42 PDT 2017


On Mon, Jun 05, 2017 at 01:14:31AM +0000, Mike B Johnson via Digitalmars-d-learn wrote:
[...]
> Guid is a struct and I am trying to get the "bytes" of the struct" to
> get the guid bytes. It is quicker than accessing all the elements one
> at a time.

	union U {
		typeof(guid) guid;
		ubyte[guid.sizeof] bytes;
	}
	U u;
	u.guid = guid;
	// ... do something with u.bytes.


T

-- 
Why are you blatanly misspelling "blatant"? -- Branden Robinson


More information about the Digitalmars-d-learn mailing list