Portability Function Attribute: @portable

Chris Williams yoreanon-chrisw at yahoo.co.jp
Tue Mar 25 14:47:27 PDT 2014


On Tuesday, 25 March 2014 at 20:16:49 UTC, Nordlöw wrote:
> Just by curiosity:
>
> What more than forbidding pointer-dribbling (casting and 
> arithmetic) and unions with members smaller than word size 
> should we require to be @portable?

Your two are all that I can think of that are definitely 
dangerous, though I would state them as "All unions with types 
larger than a byte and any access through a pointer where the 
target type is larger than a byte." You could catch a few more by 
considering equals/or/and/xor between a large lvalue and a byte 
rvalue to be non-portable. Most cases like this will either be 
related to deserializing byte arrays or people hashing/encrypting 
data. Annoying for the latter group, but valid for the former.


More information about the Digitalmars-d mailing list