
On Fri, Nov 6, 2009 at 7:55 PM, David Abrahams <dave@boostpro.com> wrote:
Why is any Boost code using reinterpret_cast? There's very little you can do portably with reinterpret_cast, and IIRC, what little you *can* do portably can also be done with static_cast.
Didn't check, but I think this case (flex_string) was probably doing some kind of small buffer optimization. Regardless, consider something like boost optional. Doesn't it hold a non-allocated buffer for the optional T? The type of the buffer is probably char []. I haven't tried it, but can you static_cast that to T? Via an intermediate cast to void * or something? (And do we know if static_cast would solve the original warnings? This is orthogonal to whether we should ever use reinterpret_cast, of course.) P.S. I agree that its use should definitely be very limited. Tony