Re: cast pid_t to int when using *printf - Mailing list pgsql-patches

From Peter Eisentraut
Subject Re: cast pid_t to int when using *printf
Date
Msg-id 200409241130.07237.peter_e@gmx.net
Whole thread Raw
In response to Re: cast pid_t to int when using *printf  ("Magnus Hagander" <mha@sollentuna.net>)
Responses Re: cast pid_t to int when using *printf  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Am Freitag, 24. September 2004 11:06 schrieb Magnus Hagander:
> > (Btw., the Windows port defines pid_t as unsigned long;
> > that's surely wrong.)
>
> In what way is that wrong? A PID on Windows is a DWORD, which is an
> unsigned long. Or am I missing something (probably..)?

The mingw header files define pid_t as int, so we shouldn't redefine it in the
first place.  The rest of the POSIX world also assumes that pid_t is signed,
so you might break a bunch of interfaces if it's not.  Note that this is
independent of the fact that the actual process identifiers are all positive,
both on Windows and on Unix systems.

(Tertiary note: Never #define one type to another, always use typedef.)

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

pgsql-patches by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: cast pid_t to int when using *printf
Next
From: Oliver Jowett
Date:
Subject: Re: cast pid_t to int when using *printf