Re: FW: [JDBC] BIGINT vs Java's long

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: FW: [JDBC] BIGINT vs Java's long
Дата
Msg-id 11890.997213443@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: FW: [JDBC] BIGINT vs Java's long  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-hackers
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> I don't think my patch against recent sources would apply cleanly to 
> older ones, and I didn't run the regression against it, but it seemed
> to work, and is only a two line change in current source.

This patch needs more work.  You are assuming that integer division on
negative numbers works the same everywhere, which it most definitely
does not (the direction of truncation was unspecified until C99).
The overflow check will fail on platforms where negative results
truncate towards minus infinity.  So we need a different way of checking
for overflow.

Right off the bat I'm not coming up with an implementation that's both
portable and able to accept INT64_MIN, but this has got to be a solved
problem.  Look around, maybe in the GNU or BSD C libraries...
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: FW: [JDBC] BIGINT vs Java's long
Следующее
От: Fernando Nasser
Дата:
Сообщение: Re: OID wraparound: summary and proposal