Do you prefer to see something like t_byte*
(with typedef unsigned char t_byte
) or unsigned char*
in code?
I\'m leaning towards
I prefer for types to convey the meaning of the values stored in it. If I need a type describing a byte as it is on my machine, I very much prefer byte_t
over unsigned char
, which could mean just about anything. (I have been working in a code base that used either signed char
or unsigned char
to store UTF-8 strings.) The same goes for uint8_t
. It could just be used as that: an 8bit unsigned integer.
With byte_t
(as with any other aptly named type), there rarely ever is a need to look up what it is defined to (and if so, a good editor will take 3secs to look it up for you; maybe 10secs, if the code base is huge), and just by looking at it it's clear what's stored in objects of that type.