Re: cast pid_t to int when using *printf

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, 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-10-09 07:57:43
Message-ID: 416799F7.6020500@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Bruce Momjian wrote:

> I see in include/sys/types.h on Solaris 9:
>
> #if defined(_LP64) || defined(_I32LPx)
> typedef uint_t nlink_t; /* file link type */
> typedef int pid_t; /* process id type */
> #else
> typedef ulong_t nlink_t; /* (historical version) */
> typedef long pid_t; /* (historical version) */
> #endif

> I am confused why you are seeing long for pid_t? What is your Solaris
> system information? If Solaris needs adjustments, there are a lot of
> place we print getpid().

This is also what is on the Solaris system I was using. gcc -E showed
that the #else branch was being taken. The #if branch is taken when
compiling in 64-bit mode (gcc -m64).

We're fine so long as everything casts to either int or long. I only saw
warnings from a couple of places that did not do a cast at all.

-O

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Devrim GUNDUZ 2004-10-09 09:59:20 (Turkish) New translation: pg_resetxlog, Updated translation: pg_ctl
Previous Message Tom Lane 2004-10-09 04:45:13 Re: more dirmod CYGWIN (was: APR 1.0 released)