"David" <> skrev i meddelandet
news: ups.com...
> I've built some code under Visual Studio C++ (2005) and sizeof(int)
> is
> 4 bytes whether the code is built for 32 or 64 bit platforms. (I'm
> running on a 64 bit machine.)
>
> I was of the impression that the Ansi spec defines 'int' to be the
> same
> as the native word size of the machine.
For some definition of 'native'.
For x64, a 32 bit int *is* the native size, as it produces the
smallest code size. To use 64 bit operands, the machine code must
include a size override prefix.
> Am I wrong or is there a
> compile flag or manifest that would get sizeof(int) to be 8?
No, there is not.
On some systems, Linux in particular, sizeof(long) might be 8. With MS
C++, sizeof(long)==sizeof(int)==8.
Bo Persson