Re: 32-bit ints on 64-bit linux

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 32-bit ints on 64-bit linux
Дата
Msg-id 1274.1111434389@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: 32-bit ints on 64-bit linux  (Kelly Burkhart <kelly@tradebotsystems.com>)
Список pgsql-odbc
Kelly Burkhart <kelly@tradebotsystems.com> writes:
> Can anyone with a better understanding of the libc standard comment on
> the "correctness" of the following lines?

> int8_t i1;
> int16_t i2;

> printf("%d", i1);
> printf("%d", i2);

That's perfectly correct, unless int is narrower than 16 bits on your
platform ;-).  Anything narrower than int is implicitly coerced to int
when it's passed to printf.  The existence of the h modifier in the
printf format syntax is for scanf, not printf; scanf does have to
know the difference between int and narrower-than-int variables.

            regards, tom lane

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

Предыдущее
От: Kelly Burkhart
Дата:
Сообщение: Re: 32-bit ints on 64-bit linux
Следующее
От: Szűcs Gábor
Дата:
Сообщение: can't set client_encoding in 7.3.2.9 - crlf bug?