Handling endianness in Tango's FileConduit

Alexander Pánek alexander.panek at brainsware.org
Sat Oct 4 13:56:29 PDT 2008


Nick Sabalausky wrote:
> 1. Rename "EndianProtocol" to "EndianSwitchProtocol" to make it's behavior 
> more clear. Possibly make it internal to Tango.
> 2. Create a new "EndianProtocol" that takes an "Endianness" enum of 
> "LittleEndian" or "BigEndian" (and maybe also "SwitchEndian" and 
> "NativeEndian") as a ctor parameter, checks the native endianness, and 
> appropriately adds or doesn't add the "EndianSwitchProtocol" (or just does 
> the byte-order swapping itself instead of using "EndianSwitchProtocol").

Please create a ticket for that!

> In any case, it looks like step 2 is something I'd currently have to 
> implement myself. Does Tango provide a way to detect the system's 
> endianness?

Tango doesn’t, but D does with version(BigEndian) or version(LittleEndian).

Also, if you implement it yourself, you can as well contribute it to 
Tango, so other people don’t have the same problem. :) You can also add 
a patch/code to the ticket. Would be awesome.

Kind regards, Alex


More information about the Digitalmars-d-learn mailing list