I'd like to announce that we've introduced an `int_fd` type in stout.
It is __not__ an RAII file descriptor type! It's actually not fancy
what-so-ever.

On POSIX, it's simply aliased to an `int`, so there's no change in usage at
all.
Just remember to use `int_fd` rather than `int` for file descriptors.

If you're wondering why we introduced this in the first place, continue
reading:

On Windows, `int_fd` is aliased to a type called `WindowsFD`. The reason is
that the abstraction on Windows has multiple types that represent
"file descriptors" from various APIs. Namely, WinCRT, Win32, WinSock.

Due to this, on Windows we have to deal with `int` from WinCRT, `HANDLE`
from Win32, and `SOCKET` from WinSock. In order to not require large changes
through the entire codebase, we've decided to rendezvous at the POSIX `int`.

`WindowsFD` is one of: `int`, `HANDLE`, and `SOCKET`, and tries its best to
provide the same API as the POSIX `int` file descriptor. Notably, the
comparison
operators are implemented to support expressions such as `fd < 0` and `fd
!= -1`.

Thanks to Daniel Pravat, Alex Clemmer, and Benjamin Hindman for helping out
with this work.

You know who you ping if you run into issues or have questions =D

Thanks,

MPark

Reply via email to