
11 Jul
2005
11 Jul
'05
9:46 p.m.
David Abrahams wrote:
Andrey Melnikov <melnikov@simplexsoft.com> writes:
David Abrahams wrote:
Andrey Melnikov <melnikov@simplexsoft.com> 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.
I know that this is your favorite, but in my opinion, "implementation defined" doesn't equal "nonportable" in this particular case. (Alignment problems notwithstanding.)