Handling endianness in Tango's FileConduit
Nick Sabalausky
a at a.a
Wed Oct 8 15:15:50 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).
>
*Smacks forehead* I knew that, and managed to forget :) That was one of the
early things that first impressd me about D.
> 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.
>
Good idea. Done:
http://www.dsource.org/projects/tango/ticket/1321
> Kind regards, Alex
More information about the Digitalmars-d-learn
mailing list