|
|
|
|
|
by delta_p_delta_x
258 days ago
|
|
Great analysis, but the solution is so simple: RAII. And this is offered as `unique_process_handle`[1] in the Windows Implementation Library (WIL)[2]. This is a fantastic addition to the Windows developer's toolkit, which everyone should be using from the outset. The Windows C API is unnecessarily verbose (although this can be said of any OS, Windows' is particularly bad), and simple mistakes can and will happen. Let RAII help you, let the mighty close-scope token `} ` be your best friend. [1]: https://github.com/microsoft/wil/blob/1f20cd086e07b9be54e70d... [2]: https://github.com/microsoft/wil |
|