Hacker News new | ask | show | jobs
by cbarrick 76 days ago
Defining BE integer data types seems like a bad approach.

I wouldn't want to maintain those types. The maintainer would either have to implement all of the arithmetic operations or assume that your users would try to hack their way to arithmetic. But really, you shouldn't ever do arithmetic with non-native endianness anyway.

Instead, define all your interfaces to work with native endianness integers and just do byte swapping at the serialization boundaries.