Boost logo

Boost :

Subject: Re: [boost] [wave][function] Suppressing gcc-4.4.1 warnings
From: David Abrahams (dave_at_[hidden])
Date: 2009-11-06 23:51:54

on Fri Nov 06 2009, Gottlob Frege <> wrote:

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

Yes, exactly that way; and it's well-defined.

> (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.)

I have no idea; that's compiler specific, but I've never seen a warning
about a static_cast.

Dave Abrahams           Meet me at BoostCon:
BoostPro Computing

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