Endianness - How to test code for portability

Preetpal preetpal.sohal at gmail.com
Fri Mar 12 05:53:40 UTC 2021


In the portability section of the language spec, they talk about 
endianness (https://dlang.org/spec/portability.html#endianness)  
which refers "to the order in which multibyte types are stored." 
IMO if you wanted to actually be sure your code is portable 
across both big endian and little endian systems, you should 
actually run your code on both types of systems and test if there 
any issues.

The problem is that I am not aware of any big-endian systems that 
you can actually test on and if there is any D lang compiler 
support for any of these systems if they exist.

This is not an important issue to me but I was just curious to 
see if anyone actually tests for portability issues related to 
endianness by compiling their D Lang code for a big endian 
architecture and actually running it on that system.


More information about the Digitalmars-d-learn mailing list