Boost logo

Boost :

Subject: Re: [boost] [AFIO] Formal review
From: Asbjørn (lordcrc_at_[hidden])
Date: 2015-09-02 17:20:03


On 02.09.2015 20:55, Niall Douglas wrote:

> That's the whole point of the intermediate size_t cast. int to size_t
> is defined behaviour, size_t to void * is defined behaviour, void *
> to size_t is defined behaviour, size_t to int is defined behaviour.

I am absolutely no expert in C++, but I was under the impression that while it's
highly likely, it's by no means guaranteed that size_t can hold a pointer.

IIRC if a platform has segmented memory then this assumption could break.

In any case, uintptr_t should be available on your target compilers no? If so,
that sounds like the better choice to me.

I may be showing my inexperience, so feel free to ignore the above if it's
bonkers :)

That said, as a humble Boost user, native_handle() returning void* sounds a bit
iffy to me. Why is it a pointer if it does not point to anything but should
rather be casted to the appropriate type by the user?

Cheers
- Asbjørn


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