Re: Slightly OT: integer sizes in C program
- From: "John Reagan" <johnrreagan@xxxxxxxxxxxxx>
- Date: Thu, 15 Jul 2010 09:16:51 -0400
So may we conclude that sizeof(long) depends on whether the compiler
runs in 32 or 64 bit mode rather than being an intrinsic feature
of the compiler itself?
32bit: long==4, 64bit: long==8.
Any example for 64bit: long==4? (which is what one of the OPs has said
about M$'s product)
Maybe the confusion comes from the fact that different compilers
use different default modes.
On the HP-UX and Linux compilers, I found that sizeof(long) == sizeof(void
*). So that matched your theory.
However, on OpenVMS, that didn't follow. Even with /POINTER=64, I found:
$ cc ll.c
$ link ll
$ run ll
2 short
4 int
4 long
8 long long
4 void *
$ cc /pointer=64 ll.c
$ link ll
$ run ll
2 short
4 int
4 long
8 long long
8 void *
Essentially, I think all you can assume is that sizeof(long) <=
sizeof(void*). I scanned the c99 standard looking for the clause, but
didn't spot in during my 2 minute timelimit.
I didn't try Visual C.
John
.
- References:
- Slightly OT: integer sizes in C program
- From: JF Mezei
- Re: Slightly OT: integer sizes in C program
- From: Michael Kraemer
- Re: Slightly OT: integer sizes in C program
- From: Arne Vajhøj
- Re: Slightly OT: integer sizes in C program
- From: Michael Kraemer
- Re: Slightly OT: integer sizes in C program
- From: Arne Vajhøj
- Re: Slightly OT: integer sizes in C program
- From: John Reagan
- Re: Slightly OT: integer sizes in C program
- From: Michael Kraemer
- Slightly OT: integer sizes in C program
- Prev by Date: Re: DEC Serial number - date of manufacture
- Next by Date: Re: DEC Serial number - date of manufacture
- Previous by thread: Re: Slightly OT: integer sizes in C program
- Next by thread: Re: Slightly OT: integer sizes in C program
- Index(es):
Relevant Pages
|