Since we've been discussing style/coding standards lately, I thought it would 
be a good time to bring up a long-standing gripe I have: the use of unsigned 
types. I'd like to suggest that the style guide mandate that the use of 
unsigned types is forbidden unless there is an explicit need for it (note I 
don't believe that "this variable ought never be negative" is a good reason). 
Good use cases would be when we're doing bitwise operations/masking, we need 
well defined overflow behavior, or we need the extra bit of precision, e.g., 
addresses.

This is already mandated in the style guide of companies like Google: 
https://google.github.io/styleguide/cppguide.html#Integer_Types, and I think 
it's generally accepted as good software engineering practice.

Also, as a somewhat related issue, I propose mandating that we shouldn't 
specify precision using the uint*_t/int*_t flavors unless we need explicit 
precision, and in many of those cases we should typedef these things, as in 
Addr.

Thoughts?
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to