Boost logo

Boost :

From: Julio M. Merino Vidal (jmmv84_at_[hidden])
Date: 2006-08-22 11:23:35

On 8/22/06, Sebastian Redl <sebastian.redl_at_[hidden]> wrote:
> On Tue, August 22, 2006 10:36 am, Julio M. Merino Vidal wrote:
> >> So, if I'm getting you, you'll change your Win32 code so that
> >> handle_type is a DWORD and can then address my requirement that a
> >> guarantee is made about handle_type being always an integral type,
> >> right?
> >
> > Yes, that's what I'm thinking.
> Wait a moment, does that mean that the internal code would cast between
> DWORD and HANDLE? That's absolutely invalid: they're not the same size on
> 64-bit systems. You'd have to use DWORD_PTR instead (an unsigned integral
> type guaranteed to be the same size as a pointer).

No. The code could expose identifiers (DWORDs) where it currently
exposes HANDLEs, but no conversion could happen between them.

Even more, it could expose both:

class process {
    id_type get_id(); // DWORD in Win32, int in POSIX
    handle_type get_handle(); // HANDLE in Win32, int in POSIX

These could return different values in Win32 but the same integer
under POSIX. I believe it makes sense because these are different
things conceptually even if the difference does not exist in Unix.

Julio M. Merino Vidal <jmmv84_at_[hidden]>
The Julipedia -

Boost list run by bdawes at, gregod at, cpdaniel at, john at