Why are void[] contents marked as having pointers?

BCS none at anon.com
Sun May 31 13:50:50 PDT 2009


Hello grauzone,

> You shouldn't cast structs or any other types to ubyte[], because the
> memory representation of those type is highly platform specific.
> Structs can contain padding, integers are endian dependend... If you
> want to convert these to binary data, write a marshaller. You _never_
> want to do direct casts, because they're simply unportable. If you do
> the cast, you have to know what you're doing.
> 

Never say never. Some cases like tmp files or whatnot where the same exe 
will save and load the file never* have any need for potability.

*"never" uses intentionally :b.





More information about the Digitalmars-d mailing list