Boost logo

Boost :

Subject: Re: [boost] Proposed SG14 <system_error2> ready for feedback
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2018-03-05 00:00:09


On 1/03/2018 11:10, Niall Douglas wrote:
> On all systems, there is a typedef `system_code` which is to the erased
> status code sufficiently large that you are guaranteed that all possible
> system error coding schemes can be safely erased into it. For POSIX,
> this is `status_code<erased<int>>`, as `int` can hold all possible error
> codings. For Windows, this is `status_code<erased<intptr_t>>`, as
> `intptr_t` can hold any of a `DWORD`, a `LONG` and a `HRESULT`.

DWORD (aka uint32_t) can hold any of DWORD, LONG, and HRESULT.

Or use LONG (aka int32_t) if you want to retain signedness of LONGs,
though I don't think any Win32 APIs require this.

In any case intptr_t is either larger than needed to preserve the value
bits (in 64-bit applications) or smaller than needed to preserve the
value and sign (in 32-bit applications), so this seems like an
inappropriate choice.

(HRESULT is not a pointer type, despite most other H* types being
derived from HANDLE. Yay for consistency.)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk