usage of integral types should be more consistent
While doing code review I have been fixing many compiler warnings, and I have noticed that there is very little consistency in the usage of integral types:
-
int
vs.long
vs.size_t
-
signed
vsunsigned
The warnings can of course be fixed by explicit casts, but a better solution is to simply be more consistent. My suggestion is the following:
- prefer
unsigned
unless sign is really necessary (e.g. HKL) - for unsigned types, prefer
size_t
since this is what is used in the STL containers (vector
etc.) - for signed types, stick to
int