On 04/19/2011 04:08 AM, Magnus Hagander wrote:
> IIRC, even while HANDLE is a 64-bit value on Win64, only the lower
> 32-bits are actually used. Took me a while to find a ref, but this is
> one I found: http://msdn.microsoft.com/en-us/library/aa384203(v=vs.85).aspx
Good.
>> I think all we need here is a way to shut up the overly-anal-retentive
>> warning. I would have expected that explicit cast to be enough,
>> actually, but apparently it's not. Ideas?
> Not sure about that one. Certainly seems like that case should be
> enough - it always was enough to silence similar warnings on MSVC in
> the past...
>
If we cast the HANDLE to a long long first and then truncate it the
compiler is silent, it only complains if that's done in one operation.
So maybe something like:
#ifdef WIN64 #define ULONGPID(x) (unsigned long) (unsigned long long) (x) #else #define ULONGPID(x) (unsigned
long)(x) #endif
...
printf(_("running on port %d with pid %lu\n"), port, ULONGPID(postmaster_pid));
It's a bit ugly, but we've done worse.
cheers
andrew