[cfe-dev] Inconsistent types used to represent bitwidth
clattner at apple.com
Wed Oct 3 13:15:42 PDT 2007
On Oct 3, 2007, at 10:56 AM, Hartmut Kaiser wrote:
> I'm currently trying to remove some of the warnings spit out on me
> by the
> VC++ compiler (mostly warnings about possible loss of precision) and
> recognized, that the bitwith (size of a type in bits) is
> represented using
> different types all over the place: sometimes unsigned, sometimes
> and sometimes it's even uint64_t. I really would like to change
> that to a
> more consistent scheme, but need some advice which type to choose.
> Since I
> think we can't expect to get anything terribly large as the
> bitwidth of a
> type I'ld say let's go for uint32_t.
We should go with uint64_t in general. There can be large arrays
(for example) on 64-bit targets that need this. For "known little
things" like integer types, uint32_t would be sufficient, but it is
probably better to be consistent and use uint64_t for everything.
More information about the cfe-dev