I have the following function:
int Foo(string sentence);
I want to know what is the maximum string length I could pass? I think it should depend on the stack size allocated to the function as this string will be copied to the stack, is that true? or it depends on string::max_size value? I'm using C++ under VS2010, windows7
EDIT. I need to have a copy as the function modifies the string contents.
The std::string
object will be copied onto the stack, but the string body will not - it will be allocated on heap. The actual limitation will depend on the system and program memory usage and can be something like from ten million to one billion charactes on a 32-bit system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With