boostorg / boostorg/process

[Question] Why boost::process::pid_t is int type in Windows OS?

Open
#94 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
145
Forks
151
PR merge metrics
No merged PRs in 30d

Description

As far as I know, Windows API defines PID as `DWORD` (e.g. `GetProcessId(HANDLE)`, `GetCurrentProcessId()`).
And it is written in the MSDN document that `DWORD` takes the value of 0 ~ 4294967295:

* https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2
* https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types#dword

I found that `boost::process::pid_t` is an alias for` int` in Windows OS:

https://github.com/boostorg/process/blob/6ccce9104ae91f6d07ac64c6d4e5fc0b57a649fe/include/boost/process/detail/windows/child_handle.hpp#L20

Why is `int` instead of the same unsigned type (`unsigned int`) as the original `DWORD`?

I know that `signed int` and `unsigned int` casts do not change the internal data.
However, When passing `boost::process::child::id()` to the Windows API, it may be inconvenient because it requires casting depending on the compilation flag (/w44365).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.