From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at> |
Cc: | "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: AW: AW: Re: RELEASE STOPPER? nonportable int64 constant s in pg_crc.c |
Date: | 2001-03-23 19:56:18 |
Message-ID: | 8835.985377378@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at> writes:
>> 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.
Sorry, perhaps I should have said "integral" constant, or something like
that. But if you read the spec you will find it calls all these things
integer constants. The relevant part of C99 says
[#5] The type of an integer constant is the first of the
corresponding list in which its value can be represented.
|| |
|| | Octal or Hexadecimal
Suffix || Decimal Constant | Constant
-------------++-----------------------+------------------------
none ||int | int
||long int | unsigned int
||long long int | long int
|| | unsigned long int
|| | long long int
|| | unsigned long long int
and I'm quite sure that ANSI C says exactly the same thing except for
not listing the long long types. This behavior is not some weird new
invention of C99 --- it has been part of the language definition since
K&R's first edition (see K&R ref section 2.4.1, if you have a copy).
Apparently the AIX compiler writers' memories do not go back to times
when int was commonly narrower than long and so this part of the spec
was really significant. Otherwise they'd not have had any difficulty
in extrapolating the correct handling of long long constants.
>>>> 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.
Okay. I've committed a configure check that tests to see whether a
macro defined as above compiles, and if so it will be used (if we are
using "long long" for int64). Hopefully the check will prevent breakage
on machines where LL is not appropriate.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-03-23 20:08:27 | Re: Re: Call for platforms |
Previous Message | Mikheev, Vadim | 2001-03-23 19:03:29 | RE: 7.0.3 _bt_restscan: my bits moved right off the end of the world! |