> On Feb. 5, 2017, 12:48 a.m., Alex Clemmer wrote:
> > 3rdparty/stout/include/stout/os/windows/fd.hpp, line 306
> > <https://reviews.apache.org/r/54591/diff/7/?file=1624392#file1624392line306>
> >
> >     I'm a bit confused about the conversion logic here... if `left` is a 
> > CRT type, can't we just `static_cast<HANDLE>(left)` and compare that to the 
> > right? What am I missing?
> >     
> >     Also just so I'm clear: your comment above is saying that the check of 
> > `< 0` is just because `left` is signed, while `right` is unsigned, so they 
> > can't be equal in this case? Is it appropriate to do a `static_assert` to 
> > make sure `HANDLE` is unsigned in the future, too?

If `left` is `CRT` let's say constructed from `0`, then the `HANDLE` is set to 
the result of `::_open_osfhandle(0)`.

At the same time, if `right` is an `INVALID_HANDLE_VALUE`, we don't want to 
compare the result of `open_osfhandle(-1)` with `INVALID_HANDLE_VALUE`, we 
simply want to compare the CRT with `-1`.

Does that make sense?


- Michael


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/#review164273
-----------------------------------------------------------


On Feb. 5, 2017, 5:04 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54591/
> -----------------------------------------------------------
> 
> (Updated Feb. 5, 2017, 5:04 p.m.)
> 
> 
> Review request for mesos, Daniel Pravat and Joris Van Remoortere.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In POSIX the socket, pipe and a file are represented by the `int` type.
> In Windows:
>   - A socket is kept in a `SOCKET` type (64 bit wide)
>   - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
>   - A CRT file descriptor in an `int`
> 
> The `WindowsFD` class is a type that brings all of these things
> together and behaves analogously to an `int` in POSIX.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/Makefile.am 53d04a9b6c4a0d8b35d3c84ef24d619fdb8a2c82 
>   3rdparty/stout/include/stout/os.hpp 
> ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
>   3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
>   3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54591/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Michael Park
> 
>

Reply via email to