Re: Windows 64 bit warnings

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Windows 64 bit warnings
Date: 2011-04-19 08:08:54
Message-ID: BANLkTi=EMKs=ABqsBEz0HmSqOvqr5HJR2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 18, 2011 at 19:00, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
>> Excerpts from Andrew Dunstan's message of sáb abr 16 21:46:44 -0300 2011:
>>> The other, slightly more serious case, is at
>>> src/test/regress/pg_regress.c:2280, which is this code:
>>>
>>> printf(_("running on port %d with pid %lu\n"),
>>> port, (unsigned long) postmaster_pid);
>>>
>>> Here the postmaster_pid is in fact a HANDLE which is 8 bytes, and so it
>>> should probably be cast to an unsigned long long and  rendered with the
>>> format %llu in Win64.
>
>> Is this "uint64" and UINT64_FORMAT?
>
> Considering that this is a purely informational printout, I don't see
> any reason to give a damn about the possibility of high-order bits in
> the HANDLE being dropped.  And it's not an especially good idea to stick
> UINT64_FORMAT into a translatable string, because of the platform
> dependency that creates.

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

> 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...

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Golub 2011-04-19 11:09:01 Warning during PostgreSQL 9.0.4 libpq.dll build on WinXP+MinGW
Previous Message Tom Lane 2011-04-19 06:34:34 Re: Formatting Curmudgeons WAS: MMAP Buffers