Re: VS 2015 support in src/tools/msvc - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: VS 2015 support in src/tools/msvc
Date
Msg-id 571BD6D4.9@dunslane.net
Whole thread Raw
In response to Re: VS 2015 support in src/tools/msvc  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: VS 2015 support in src/tools/msvc  (Christian Ullrich <chris@chrullrich.net>)
List pgsql-hackers

On 04/22/2016 01:21 AM, Michael Paquier wrote:
>>> 5. It also complains about us casting a pid_t to a HANDLE in
>>> pg_basebackup.c. Not sure what to do about that.
>> The thing that's being cast is not a PID, but a HANDLE to a process. pid_t is a typedef for int (in port/win32.h),
thereforeis always 32 bits, while HANDLE is actually void*. However, Microsoft guarantees that kernel32 HANDLEs (this
includesthose to threads and processes) fit into 32 bits on AMD64.
 
>>
>> Source: https://msdn.microsoft.com/en-us/library/windows/desktop/ee872017(v=vs.85).aspx, third bullet point.
>>
>> So we can simply silence the warning by casting explicitly.
> Yes, when casting things this way I think that a comment would be fine
> in the code. We could do that as separate patches actually.


We are already casting the pid_t to HANDLE and still getting a warning. 
Apparently we need to do something on win64 like
    (HANDLE) ((int64) bgchild)


cheers

andrew




pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: GIN data corruption bug(s) in 9.6devel
Next
From: Christian Ullrich
Date:
Subject: Re: VS 2015 support in src/tools/msvc