Re: 64 bit pointer in C
- From: tony_curtis32@xxxxxxxxx
- Date: Fri, 23 Oct 2009 16:04:19 -0500
jay <gl@xxxxxxxxxxxxxxxx> writes:
this oughta be simple, but somehow i can't blunder my
way on to it. it's probably a FAQ. either solaris compilers
or gcc ought to be enough of a hint for me -- if i have one
i expect i can find the other.
sizeof( int * ) for int, double, this, that, the other always
gives me 4 bytes. that means on a 64 bit machine w/
16GB memory i'll "run out" of addresses. are there compiler
options that will give me 64 bit pointer sizes?
$ cat pointer.c
#include <stdio.h>
#define DO_PTR_SIZE(type) printf("sizeof(%s *) = %d\n", #type, sizeof(type *))
int
main(void)
{
DO_PTR_SIZE(char);
DO_PTR_SIZE(short);
DO_PTR_SIZE(int);
DO_PTR_SIZE(long);
DO_PTR_SIZE(double);
return 0;
}
$ cc -m32 pointer.c
$ ./a.out
sizeof(char *) = 4
sizeof(short *) = 4
sizeof(int *) = 4
sizeof(long *) = 4
sizeof(double *) = 4
$ cc -m64 pointer.c
$ ./a.out
sizeof(char *) = 8
sizeof(short *) = 8
sizeof(int *) = 8
sizeof(long *) = 8
sizeof(double *) = 8
s/cc/gcc/ as required
hth
t
.
- Follow-Ups:
- Re: 64 bit pointer in C
- From: Andrew Gabriel
- Re: 64 bit pointer in C
- From: jay
- Re: 64 bit pointer in C
- References:
- 64 bit pointer in C
- From: jay
- 64 bit pointer in C
- Prev by Date: Re: Can't get the network configured
- Next by Date: Re: Can't get the network configured
- Previous by thread: Re: 64 bit pointer in C
- Next by thread: Re: 64 bit pointer in C
- Index(es):
Relevant Pages
|