← Back to context

Comment by charcircuit

1 day ago

This has been largely solved by everyone agreeing to use little endian. There aren't really use cases for wanting to convert between them.

Does that mean there are no file formats thatbuse big endian? And network byte order isn't a thing?

  •     > there are no file formats thatbuse big endian
    

    if someone chooses to do that they own the problems.

        > network byte order isn't a thing
    

    if the network serializes/deserializes for you (kernel primitives) then you don't care what it does. if it doesn't and for some reason you choose to use big endian, again, you own the problem.

    • Network byte order has nothing to do with the kernel and you have to care about it

      It’s a standard because neither side of the connection knows the endianness of the other side so there must be a standard. That standard is big endian regardless of your architecture or kernel or anything else

      So any serialization intended go over the network should be big endian

      5 replies →

  • Generally those edge cases are always the same endianness. You don't need big and little endianness versions of the structures. What's important is that everyone agrees on the same thing.

    • There are some cursed data formats where something is little endian in some places, big endian in other places

      Generally speaking though the types you handle in business logic (what your application actually do) shouldn't have any endianness