Portability Function Attribute: @portable

"Nordlöw" per.nordlow at gmail.com
Tue Feb 25 15:02:06 PST 2014


I have a suggestion for yet another cool feature that would be 
nice to have in D...namely a *portability* attribute perhaps 
called

@portable

Any functions that are marked as @portable would be forbidden to 
do calculations whose result have different results on targets 
with different endianess. The only examples I can think of right 
now is:

- Reinterpreting pointers and ranges between types with different 
word size in a way that endianness would affect result (explicit 
use)
- Using unions with same effects (implicit use)

I'm guessing this static analysis would have similarities with 
how @safe functions are checked, right?

Also, can you think any other property than endiness-dependence 
such a property would forbid a function to have.

Destroy!


More information about the Digitalmars-d mailing list