Re: Windows 64 bit warnings

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Windows 64 bit warnings
Дата
Msg-id 4DAD75E7.9060608@dunslane.net
обсуждение исходный текст
Ответ на Re: Windows 64 bit warnings  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: Windows 64 bit warnings  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers

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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Golub
Дата:
Сообщение: Warning during PostgreSQL 9.0.4 libpq.dll build on WinXP+MinGW
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Warning during PostgreSQL 9.0.4 libpq.dll build on WinXP+MinGW