Skip site navigation (1) Skip section navigation (2)

Re: cast pid_t to int when using *printf

From: Neil Conway <neilc(at)samurai(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: 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-09-24 10:34:24
Message-ID: 1096022064.25688.676.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: pgsql-patches
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 to pid_t, so we will need a cast there either 
> way.

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?

-Neil



In response to

Responses

pgsql-patches by date

Next:From: Tom LaneDate: 2004-09-24 14:13:22
Subject: Re: cast pid_t to int when using *printf
Previous:From: Oliver JowettDate: 2004-09-24 10:31:59
Subject: Re: cast pid_t to int when using *printf

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group