| maruthu (1) | |
|
I am using keep on string appending without limitation it crash the system example i am using std::string a="abc"; for( int i = 0 ; i < 50 ; i++) { a=a+a; } std::cout << a; It will crash system I need to give max limit to the string with out system hang. | |
|
Last edited on
|
|
| kbw (5375) | |
|
It doesn't crash my system (32bit ppc/gcc 4.0), and it shouldn't crash yours either. What do you mean by "crash"? | |
|
|
|
| fun2code (1063) | |
|
It doesn't? Wouldn't the resulting string be about 3*(2^50) = 10^15 = | |
|
Last edited on
|
|
| kbw (5375) | |
|
It throws an exception (as you'd expect). Why would you think it will crash? | |
|
Last edited on
|
|