From: David B. Held (dheld_at_[hidden])
Date: 2002-08-20 02:42:26
"Philippe A. Bouchard" <philippeb_at_[hidden]> wrote in message
> Two things left to be done:
> - ptrdiff_t to size_t convertions;
> - BOOST_DATA_ALIGNMENT explicit ports (prob < 0.001).
I wouldn't call this "98% portable" until you show that it works correctly
on 98% of all compilers. Right now, it still looks like it's doing some
rather hairy things. For instance, "1" doesn't point to an actual U*,
or anything that can be construed as an actual U*, so I'm not sure
whether it's valid to perform a conversion to T* on such a pointer.
I like Larry Evans' solution of casting a char to a U* then to a T*,
as a char that is the same size as U is guaranteed to have the same
alignment, etc. (I believe, but don't quote me on that). And the fact
that the char is convertible to an actual pointer, rather than a contrived
integral constant must surely be more portable than U*(1). Also, all
the reinterpret_casts must be demonstrated to work as expected for
your use case with much more rigorous examples than you have so
far. And test results for different compilers would lend some weight
to the claim that the pointer is actually *portable*.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk