From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | Neil Conway <neilc(at)samurai(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-10-14 20:22:46 |
Message-ID: | 200410142022.i9EKMls20284@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
OK, 'int' cast added to getpid() calls with %d; patch attached.
---------------------------------------------------------------------------
Bruce Momjian wrote:
> Neil Conway wrote:
> > Bruce Momjian wrote:
> > > Tom Lane wrote:
> > >>Traditionally PIDs fit in 16 bits, let alone 32. I'd recommend that we
> > >>standardize on casting pid_t to int for printing purposes;
> > >
> > >
> > > Done.
> >
> > Uh, what? Your patch removes the casting of pid_t to int -- Tom was
> > suggesting that we consistently cast pid_t to int. (Also your patch
> > removes casting from uid_t to int in the case of geteuid() -- why?)
> >
> > For instance:
> >
> > http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/psql/command.c.diff?r1=1.126&r2=1.127
>
> >From Tom:
>
> > Traditionally PIDs fit in 16 bits, let alone 32. I'd recommend that we
> > standardize on casting pid_t to int for printing purposes;
>
> OK, I read Tom's email saying that we use %d consistently. I didn't
> realize he was also saying cast getpid(), but that is easy to do.
>
> Before we had "%ld" sometimes, (int) cast others, and sometimes neither.
> It is now consistent and we can make the change all at once.
>
> So I assume everyone wants:
>
> printf("%d", (int) getpid())?
>
> Is this correct?
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania 19073
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 4.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2004-10-14 22:18:10 | Re: Slightly better testing for pg_ctl(1)'s -w... |
Previous Message | Jon Jensen | 2004-10-14 19:51:04 | Re: plperl Safe restrictions |