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

Re: cast pid_t to int when using *printf

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Oliver Jowett <oliver(at)opencloud(dot)com>,Peter Eisentraut <peter_e(at)gmx(dot)net>,pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: cast pid_t to int when using *printf
Date: 2004-09-24 14:13:22
Message-ID: 21288.1096035202@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Neil Conway <neilc(at)samurai(dot)com> writes:
> I guess it would be safest to use %ld and cast pid_t to long. Of course,
> this seems a little paranoid -- is there actually a system with
> sizeof(pid_t) != 4?

Traditionally PIDs fit in 16 bits, let alone 32.  I'd recommend that we
standardize on casting pid_t to int for printing purposes; I think
that's what's being done in more places than not.  Also, as you note, we
are using int variables to hold PIDs in many places --- I don't think
it's worth running around and changing those either.

			regards, tom lane

In response to

Responses

pgsql-patches by date

Next:From: Kris JurkaDate: 2004-09-24 16:50:25
Subject: Code/comment cleanups now that odbc is gone.
Previous:From: Neil ConwayDate: 2004-09-24 10:34:24
Subject: Re: cast pid_t to int when using *printf

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