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
In response to
pgsql-hackers by date
|Next:||From: Tom Lane||Date: 2001-03-23 20:08:27|
|Subject: Re: Re: Call for platforms |
|Previous:||From: Mikheev, Vadim||Date: 2001-03-23 19:03:29|
|Subject: RE: 7.0.3 _bt_restscan: my bits moved right off the end of the world! |