Re: 64 bit pointer in C



In article <87zl7hhlf0.fsf@xxxxxxxxx>,
tony_curtis32@xxxxxxxxx writes:
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;
}

There's a more fully featured program enquire.c which does this
and lots more, http://homepages.cwi.nl/~steven/enquire.html

--
Andrew Gabriel
[email address is not usable -- followup in the newsgroup]
.



Relevant Pages

  • Re: 64 bit pointer in C
    ... either solaris compilers ... or gcc ought to be enough of a hint for me -- if i have one ... sizeof(int *) for int, double, this, that, the other always ...
    (comp.unix.solaris)
  • 64 bit pointer in C
    ... either solaris compilers ... or gcc ought to be enough of a hint for me -- if i have one ... sizeof(int *) for int, double, this, that, the other always ... options that will give me 64 bit pointer sizes? ...
    (comp.unix.solaris)
  • Re: 64 bit pointer in C
    ...  it's probably a FAQ. ... or gcc ought to be enough of a hint for me -- if i have one ...
    (comp.unix.solaris)