/Wp64 and sizeof int question 
Author Message
 /Wp64 and sizeof int question

I am looking at this MSDN page on the /Wp64 compiler flag which is
used to check for portability to 64 bit platforms:

http://www.*-*-*.com/

I understand treating pointers and longs as 64 bits to test for
portability, but I'm not so clear on the reason for treating integers
as 64 bit values to test portability. Presumably VC++ still treats int
as a 32 bit value even when compiling in 64 bit mode, right? So is
this just in case there is some other architecture out there that
happens to treat ints as 64 bit values on 64 bit systems? Or am I
misunderstanding the above page?

Thanks,
Martin



Sun, 19 Dec 2004 07:33:17 GMT  
 /Wp64 and sizeof int question
I think the page is misleading.

The phrase:

"Variables of the following types are tested on a 32-bit operating system as
if they were 64 bits:"

I think should read something like:

"Variables of the following types are tested on a 32-bit operating system as
if they were the sizes that they have on 64 bit Windows".

In fact, only pointers are 64 bits - int & long are both still 32 bits
(unless something's changed since I last read up on Win64, that is).

-cd


Quote:
> I am looking at this MSDN page on the /Wp64 compiler flag which is
> used to check for portability to 64 bit platforms:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcco...
Quote:

> I understand treating pointers and longs as 64 bits to test for
> portability, but I'm not so clear on the reason for treating integers
> as 64 bit values to test portability. Presumably VC++ still treats int
> as a 32 bit value even when compiling in 64 bit mode, right? So is
> this just in case there is some other architecture out there that
> happens to treat ints as 64 bit values on 64 bit systems? Or am I
> misunderstanding the above page?

> Thanks,
> Martin



Sun, 19 Dec 2004 07:59:33 GMT  
 /Wp64 and sizeof int question
There are several types that are 64 bits in the new os. At least pointers,
ptr_diff_t, time_t, size_t, ssize_t, and maybe some others. (It's all in the
documentation) int and long remain 32 bits on the itanium, but I've heard
that eventually long will become 64 bit. I wouldn't bet on it though. It's
common on other 64 bit platforms for int to be 32 bit and long to be 64. If
you find code that assumes a pointer will fit in a long then you can use the
LONG_PTR or ULONG_PTR macros to ensure the right behavior. Assuming it's
unnacceptable to change the algorithm, that is.

HTH,

Justin Michel
OCI


Quote:
> I am looking at this MSDN page on the /Wp64 compiler flag which is
> used to check for portability to 64 bit platforms:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcco...
Quote:

> I understand treating pointers and longs as 64 bits to test for
> portability, but I'm not so clear on the reason for treating integers
> as 64 bit values to test portability. Presumably VC++ still treats int
> as a 32 bit value even when compiling in 64 bit mode, right? So is
> this just in case there is some other architecture out there that
> happens to treat ints as 64 bit values on 64 bit systems? Or am I
> misunderstanding the above page?

> Thanks,
> Martin



Sun, 19 Dec 2004 21:26:58 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. size_t and unsigned int conversion errors with /Wp64 switch

2. relation between sizeof(void*), sizeof(int)

3. sizeof(int) sizeof(long) etc.

4. Basic question on sizeOf variables int, long

5. Why not sizeof int?

6. how to modify a pointer to an array one sizeof(int)

7. sizeof(int)

8. Sizeof int

9. sizeof int

10. sizeof(int)

11. int overflow and sizeof

12. sizeof(int) on 16-bit Atari ST.

 

 
Powered by phpBB® Forum Software