All pastes #638137 Raw Edit

Mine

public text v1 · immutable
#638137 ·published 2007-07-29 15:43 UTC
rendered paste body
std::string somefunc (const std::string &someparam) {
   ....
   ....
   MessageBox(NULL, "RET", "", MB_OK);
   MessageBox(NULL, ret.c_str(), "", MB_OK);
   return ret;
}

@ main:
....
MessageBox(NULL, "3", "", MB_OK);
string out = somefunc(someparam);
MessageBox(NULL, "4", "", MB_OK);
....

I get the following alerts:
1. 3
2. RET
3. the value of ret (a big string)
4. instead of getting 4, it crashes
So there obviously is a problem with copying the return value to out.
This has never happened before, and I think it happens now because I return bigger strings.
May be because out does not allocate that much or something (even tho it should when it copies).