Boost logo

Boost :

Subject: Re: [boost] [AFIO] Formal review
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-09-02 19:21:12

On 2 Sep 2015 at 23:20, Asbjørn 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.

True. It is however true on all the platforms AFIO supports.

That is still no excuse however. size_t is for array indexes, not
addresses where a uintptr_t is a better type.

> 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've logged the issue to to do just that.

> 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?

Old habits of a C programmer: void * is for any "carry maximum
information". Besides, there is form: Boost.Python defines the
standard opaque Python-can't-understand-this type as a void * (I
contributed the implementation myself a very long time ago).


ned Productions Limited Consulting

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