On 02/23/2010 07:59 AM, Denys Vlasenko wrote:
Because int32_t is a type with explicit bit width.
It is supposed to be used only when you _have to_ have an exactly
32-bit wide variable.
OTOH int type is an "integer of natural size for this architecture".
20 years from now, on most machines "int" will probably be 64-bit
and people would wonder "why abrt_errno is int32_t? there must be
some special reason for that...". But there is not.
I would encourage you to at least create a typedef for this, with a
comment explaining the range of values, and the operations the type
should support. Since this is C++ you could also get stronger type
checking by using a class containing only the functions you want this
type to support. GCC's optimization of single member classes is pretty
good.
How ever you abstract this, if you abstract it at all, you should look
at the new ISO C/C++ types like uint_fast16_t, or even uint_fast8_t.
See
http://www.gnu.org/software/libc/manual/html_node/Integers.html#Integers.
-gavin...