On 5/22/06, Nuno Lucas <[EMAIL PROTECTED]> wrote:
On 5/22/06, Cory Nelson <[EMAIL PROTECTED]> wrote:
> The warning is likely because  size_t can be 64bit and "int" is always
> 32bit.  Either way, it should be casted.

Not really, size_t can be 64 or any other size in bits and same with int's.

He is compiling it with VC++, where size_t is always the size of a
pointer and int is always 32bit.

If I'm not mistaken, size_t is 64 bits on Microsoft 64 bits compiler
and int is 32 bits on the same compiler, but gcc 64 bits  version have
both as 64 bits (at least for x86-64). I'll omit the 16 bit cases of
some years ago.

I'm not fully sure about this as I never had to do any programming for
64 bits, yet, so correct me if I'm wrong.

GCC's int is also 32bit on x64 (likely because x64 supports 32bit
arithmetic in 64bit apps without penalty, while 64bit operations
require a REX prefix which increases code size and can hurt cache).
The type that differs between the compilers is long, which is 32bit in
vc++ and 64bit in gcc.

If you really want to be sure of the size of types, use the C99
<stdint.h> header and use things like int32_t, uint32_t, int64_t and
uint64_t (and all other types defined there).

I agree, but we're going to hijack Brannon's thread if we aren't careful.

To get back on track:  Brannon, submit a patch.  An alarmingly high
number of people believe those warnings are superfluous and from what
I understand drh is one of them, so I imagine a patch is the only way
proper casting will be put in.


Best regards,
~Nuno Lucas



--
Cory Nelson
http://www.int64.org

Reply via email to