This question is neither a problem, nor a bug.
I was wondering about memory-intensive parameters. Let's say we have:
Code: Select all
myFun1(string param)
{
DebugN("This is function myFun1 and param=", param);
}Code: Select all
myFun2(const string ¶m)
{
DebugN("This is function myFun2 and param=", param);
}I was wondering if, internally, the interpreter, for myFun1, is actually creatring a whole new string variable and copying the passed value onto it, or param is just an internal reference to the original string, with a copy-on-write policy.
Whatever is happening under the hood, I would like to know if is "myFun2" more efficient than "myFun1"? (In terms of memory ussage, I expect a parsing overhead for myFun2)
It is my understanding that dynamic-size types, like dyn_string or mappings are to be passed as const& when no modifications are to be made. Am I right?
Regards,