AW: AW: Re: RELEASE STOPPER? nonportable int64 constant s in pg_crc.c

From: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: AW: AW: Re: RELEASE STOPPER? nonportable int64 constant s in pg_crc.c
Date: 2001-03-23 17:10:23
Message-ID: 11C1E6749A55D411A9670001FA68796336825A@sdexcsrv1.f000.d0188.sd.spardat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> >> I'm aware that some compilers will produce warnings about these
> >> constants, but there should not be any that fail completely, since
> >> (a) we won't be compiling this code unless we've proven that the
> >> compiler supports a 64-bit-int datatype, and
>
> > Unfortunately configure does not check the use of 64 bit integer
> > constants. A little check on AIX shows, that it indeed DOES
> NOT work !!!!!
>
> Grumble...
>
> >> (b) the C standard
> >> forbids a compiler from requiring width suffixes (cf.
> 6.4.4.1 in C99).
>
> > Maybe that standard is somewhat too recent to rely upon 100%.
>
> ANSI C says the same thing, although of course it only discusses int and
> long. But the spec has always been clear that the implied type of an
> integer constant is whatever it takes to hold it; you do not need an
> explicit "L" suffix to make a valid constant. AIX's compiler
> is broken.

Reading your above note I do not see, how you map this statement
to a long long int (64 bits) on a platform where int is 32 bits. On this platform
we are definitely not talking about an integer constant.

> > Do you want me to supply an AIX specific patch with #if defined (_AIX) ?
>
> I'll do something about it. Would you check to see whether a > macro like
> #define SIXTYFOUR(x) x##LL works?

Yes, that works. Unfortunately I will only be able to test on Monday.

Could you use something like the following in configure, to test it ?

#define SIXTYFOUR(x) x
if (sizeof(SIXTYFOUR(0x0)) == 8)
printf ("0x0 is 64 bits\n");
else return(-1);

#define SIXTYFOUR(x) x##LL
if (sizeof(SIXTYFOUR(0x0)) == 8)
printf ("0x0LL is 64 bits\n");
else return (-1);

Andreas

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthew 2001-03-23 17:11:39 RE: 7.0.3 _bt_restscan: my bits moved right off the end of the world!
Previous Message Mikheev, Vadim 2001-03-23 17:01:49 RE: 7.0.3 _bt_restscan: my bits moved right off the end of the world!