Обсуждение: AW: ecpg long int problem on alpha + fix

Поиск
Список
Период
Сортировка

AW: ecpg long int problem on alpha + fix

От
Zeugswetter Andreas SB
Дата:
> > Could you please try to just remove the cpp flag? Also I wonder why you are
> > using "long long int" instead of just "long int" in your C program. Well
> > that is the people who complained to you.
> 
> Yes, dropping the CPP flags solves the problem for us. I assume all
> platforms have long long now?
> 
> We used long long as this seems to be pretty consistently 64 bits on
> different platforms, and our code runs on Tru64, PC linux and openBSD.

I think the people did the perfectly correct thing to use long long int,
since that makes their code more portable.
Can someone try to help me understand this please ?
My understanding so far is:1. long int is the same as long (32 or more bits)2. long long int is at least 64 bits (I
haveso far not seen more that 64 bits)    (my original understanding was that it is 64bits, but Tom corrected me)
 

So my conclusion would be, that ecpg should understand "long long int" since
that is preferable over a "long int" that is 64bits by chance.

I do agree with the statement, that HAVE_LONG_LONG_INT_64 shoud be
defined on all platforms where the compiler understands it to be 64bits.
It would imho be the responsibility of backend code, to only do one of
the two if both are defined.
Otherwise the defines should have a different name like USE_....

Andreas


Re: ecpg long int problem on alpha + fix

От
Michael Meskes
Дата:
On Thu, Apr 05, 2001 at 10:01:53AM +0200, Zeugswetter Andreas SB wrote:
> I do agree with the statement, that HAVE_LONG_LONG_INT_64 shoud be
> defined on all platforms where the compiler understands it to be 64bits.
> It would imho be the responsibility of backend code, to only do one of
> the two if both are defined.

I just committed some changes so that ecpg does acceptt "long long"
variables all the time, but repleces them with type "long" if
HAVE_LONG_LONG_INT_64 is not defined. This appears to be a strategy similar
to the one used by the backend.

Michael
-- 
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!


Re: ecpg long int problem on alpha + fix

От
Tom Lane
Дата:
Michael Meskes <meskes@postgresql.org> writes:
> I just committed some changes so that ecpg does acceptt "long long"
> variables all the time, but repleces them with type "long" if
> HAVE_LONG_LONG_INT_64 is not defined.

This looks like a workable strategy for now.  Ten years from now, when
"long" means 64 bits everywhere and people are starting to use "long long"
to mean 128 bits, we'll have to revisit it ;-)
        regards, tom lane