Skip site navigation (1) Skip section navigation (2)

Re: 32-bit ints on 64-bit linux

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kelly Burkhart <kelly(at)tradebotsystems(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>,Kelly Burkhart <kelly(at)kkcsm(dot)net>, pgsql-odbc(at)postgresql(dot)org
Subject: Re: 32-bit ints on 64-bit linux
Date: 2005-03-21 19:46:29
Message-ID: 1274.1111434389@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-odbc
Kelly Burkhart <kelly(at)tradebotsystems(dot)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

In response to

pgsql-odbc by date

Next:From: Szűcs GáborDate: 2005-03-22 10:13:36
Subject: can't set client_encoding in 7.3.2.9 - crlf bug?
Previous:From: Kelly BurkhartDate: 2005-03-21 19:28:59
Subject: Re: 32-bit ints on 64-bit linux

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group