Re: 32-bit ints on 64-bit linux - Mailing list pgsql-odbc

From Tom Lane
Subject Re: 32-bit ints on 64-bit linux
Date
Msg-id 1274.1111434389@sss.pgh.pa.us
Whole thread Raw
In response to Re: 32-bit ints on 64-bit linux  (Kelly Burkhart <kelly@tradebotsystems.com>)
List 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 by date:

Previous
From: Kelly Burkhart
Date:
Subject: Re: 32-bit ints on 64-bit linux
Next
From: Szűcs Gábor
Date:
Subject: can't set client_encoding in 7.3.2.9 - crlf bug?