[C++-sig] [c++-sig] python std::string assignment

David Abrahams dave at boostpro.com
Fri Oct 17 16:31:34 CEST 2008


on Fri Oct 17 2008, Stefan Seefeld <seefeld-AT-sympatico.ca> wrote:

> Furkan Kuru wrote:
>> By the way
>>
>> I tried
>> "resize"ing and "reserve"ing of strings
>> by
>>
>> name.resize(1024);
>> or
>> name.reserve(1024);
>>
>> but it did not fix the problem.
>>
>> It seems that it allows up to 15 chars + null character total 16chars.
>> I think strings set longer than 15 chars corrupts the stack.
>
> I remember having seen similar behavior in a former life of mine, when
> I had to work with various MS platforms. I'm pretty sure this is
> entirely unrelated to your use of boost, but rather caused by your
> compilation settings such as mixing different Windows runtime
> libraries for the different components of your application.

Yes, that seems very likely; this looks a bit like the small string
optimization gone awry.  Perhaps you have mixed the MS runtime lib
headers with a different version of the binary library.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com


More information about the Cplusplus-sig mailing list