Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-07-11 16:25:51


Andrey Melnikov <melnikov_at_[hidden]> writes:

> David Abrahams wrote:
>> Andrey Melnikov <melnikov_at_[hidden]> writes:
>>
>>>char bar_placeholder[sizeof(std::string];
>>>std::string *bar = reinterpret_cast<std::string*>(bar_placeholder);
>>
>>
>> reinterpret_cast is nonportable.
>
> Why? I don't see any reasons why reinterpert_cast from char [] to
> std::string * could be nonportable.

The standard says so. It's implementation-defined.

<snip>

> I can't imagine how a compiler can avoid calling a non-trivial copy
> constructor like in case of std::string.

The standard says it can.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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