On Mon, 3 May 2021 20:29:03 +0200 Richard Braun <rbr...@sceen.net> wrote:
> The two schools are : Personally I subscribe to a third school of thought: it’s good to use the type system to communicate information to other programmers. If I see that a variable is unsigned, I know it can never be negative. Every time I see something that’s conceptually unsigned (e.g. a count or size) but uses a signed type, it adds cognitive overhead because I have to figure out why it’s signed—is it just because it was written by someone who likes using signed types for unsigned values, or is there extra information in there, such as using negative values for special placeholder values? If it’s unsigned, it’s pretty obviously just a plain count or size value, and I can get on with my life. There’s not all that much information that one can communicate via the type system in C compared to some other languages, but when the option is there, I prefer to use it. -- Christopher Head
pgpuX5n1YSDEz.pgp
Description: OpenPGP digital signature