Recently I coded something with a not-very-important slow-changing rarely-used 
positive number: `unsigned mGeneration;`
My reviewer commented: "Please use a type with an explicit size, such as 
uint32_t. (General mozilla style; you don't see a bare "unsigned" around much)"

I had never heard of this (in 4+ years), so I did a bit of research:

- I found plenty of `unsigned`s around, more than `uint32_t`s.

- I can't see anything about that in our coding style guides [1, 2].

- Our latest coding style [1] points at Google's, which has a section about 
Integer Types [3], and the basic gist is: Use plain `int` for "not-too-big" 
numbers, int64_t for "big" numbers, intXX_t if you need a precise size; never 
use any unsigned type unless you work with bitfields or need 2^N overflow (in 
particular, don't use unsigned for always-positive numbers, use signed and 
assertions instead).

So, questions:
1. Do we have a written style I missed somewhere?
2. Do we have an unwritten style? (In which case I think we should write it 
3. What do we think of the Google style, especially the aversion to unsigned?


dev-platform mailing list

Reply via email to