Re: cast pid_t to int when using *printf

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: Neil Conway <neilc(at)samurai(dot)com>, pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: cast pid_t to int when using *printf
Date: 2004-09-24 08:56:17
Message-ID: 200409241056.17321.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Am Freitag, 24. September 2004 09:34 schrieb Oliver Jowett:
> Neil Conway wrote:
> > On Fri, 2004-09-24 at 16:51, Oliver Jowett wrote:
> >>gcc (3.2.3 on Solaris 9) warns about a couple of places where a pid_t is
> >>formatted with %d by a printf-family function.
> >
> > For curiosity's sake, what formatting escape does gcc prefer?
>
> I don't think there is an escape for pid_t, you always have to cast it.

I think what he was asking is this: Since pid_t has to be a signed integer
type, but gcc does not accept %d for it, then it could be that pid_t is wider
than an int, so casting it to int would potentially lose information.

(Btw., the Windows port defines pid_t as unsigned long; that's surely wrong.)

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2004-09-24 09:06:23 Re: cast pid_t to int when using *printf
Previous Message Michael Paesold 2004-09-24 08:42:03 Re: psql: rollback only last query on error