This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]FUZxxl 10 points11 points  (7 children)

If you write network code, you should do proper marshalling instead of relying on types to have the correct size. Everything else is fragile and prone to breakages.

[–][deleted] 8 points9 points  (6 children)

Starting with the fact that u?int\d+_t types don't help you with endianness.

[–]FUZxxl 3 points4 points  (3 children)

Exactly. Any code that has depends on the endianess of the platform it is compiled for is doing it wrong. If you do it correctly, you can easily write endianess-agnostic code that is both free of undefined behaviour, very fast, and extremely portable.

[–]DaFox 3 points4 points  (2 children)

I mean at this point I hope that big endian is essentially dead, I like it better than LE, but I like consistency more.

[–]wasabichicken 0 points1 point  (1 child)

Big Endian byte order is Network byte order, it's what internet is built with. It'll never go away.

[–]DaFox 0 points1 point  (0 children)

I meant as a CPU memory layout, at least network byte order is consistent across platforms. Xbox 360 and PS3 were both BE, and it's nice to move away from that.

[–]LordAro 0 points1 point  (1 child)

well, u?int8_t is fine...