Re: [PATCHES] cast pid_t to int when using *printf

2004-10-14 Thread Bruce Momjian
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

Re: [PATCHES] cast pid_t to int when using *printf

2004-10-09 Thread Oliver Jowett
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

Re: [PATCHES] cast pid_t to int when using *printf

2004-10-08 Thread Bruce Momjian
Peter Eisentraut wrote: 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

Re: [PATCHES] cast pid_t to int when using *printf

2004-10-08 Thread Bruce Momjian
Tom Lane wrote: Neil Conway [EMAIL PROTECTED] writes: I guess it would be safest to use %ld and cast pid_t to long. Of course, this seems a little paranoid -- is there actually a system with sizeof(pid_t) != 4? Traditionally PIDs fit in 16 bits, let alone 32. I'd recommend that we

Re: [PATCHES] cast pid_t to int when using *printf

2004-10-08 Thread Bruce Momjian
Oliver Jowett wrote: Peter Eisentraut wrote: 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

Re: [PATCHES] cast pid_t to int when using *printf

2004-10-08 Thread Neil Conway
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.

Re: [PATCHES] cast pid_t to int when using *printf

2004-09-24 Thread Neil Conway
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? -Neil ---(end of

Re: [PATCHES] cast pid_t to int when using *printf

2004-09-24 Thread Peter Eisentraut
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

Re: [PATCHES] cast pid_t to int when using *printf

2004-09-24 Thread 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..)? //Magnus ---(end of broadcast)--- TIP 5:

Re: [PATCHES] cast pid_t to int when using *printf

2004-09-24 Thread Peter Eisentraut
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

Re: [PATCHES] cast pid_t to int when using *printf

2004-09-24 Thread Oliver Jowett
Peter Eisentraut wrote: 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,

Re: [PATCHES] cast pid_t to int when using *printf

2004-09-24 Thread Neil Conway
On Fri, 2004-09-24 at 20:31, Oliver Jowett wrote: pid_t on the Solaris/sparc system is a long (but both int and long are 32 bits). Some experimentation shows that gcc is happy with a %ld format specifier. But compiling the same code on a Linux/x86 system makes gcc complain when applying %ld

Re: [PATCHES] cast pid_t to int when using *printf

2004-09-24 Thread Tom Lane
Neil Conway [EMAIL PROTECTED] writes: I guess it would be safest to use %ld and cast pid_t to long. Of course, this seems a little paranoid -- is there actually a system with sizeof(pid_t) != 4? Traditionally PIDs fit in 16 bits, let alone 32. I'd recommend that we standardize on casting