Re: cast pid_t to int when using *printf
От | Bruce Momjian |
---|---|
Тема | Re: cast pid_t to int when using *printf |
Дата | |
Msg-id | 200410092208.i99M8KT23309@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: cast pid_t to int when using *printf (Neil Conway <neilc@samurai.com>) |
Ответы |
Re: cast pid_t to int when using *printf
|
Список | pgsql-patches |
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@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
В списке pgsql-patches по дате отправления: