4 ms·
The library provides those functions too, but I don't see how having an arithmetic type with well defined size, endiannness and alignment is a bad thing. If yo
by nly 6y ago
The library provides those functions too, but I don't see how having an arithmetic type with well defined size, endiannness and alignment is a bad thing.
If you're defining a struct to mirror a data structure from a device, protocol or file format then the language / type system should let you define the properties of the fields, not necessarily force you to introduce a parsing/decoding stage which could be more easily bypassed.
- lanstin 6y agoIt is no longer arithmetic if there is an endianness. Some things are numbers and some things are sequences of bytes. Arithmetic only works on the former.