Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
tiny problem for cc
(1/1)
blueshake:
hi,guys
I see that some codes in cc like this one.
e.g.
--- Code: ---void functionname (const classname& var)
{
classname localvar = var;
......
}
--- End code ---
here,in the function body functionname, why it make a copy for "var".
if want to make a copy for "var",why not use it in this way??
--- Code: ---void functionname (const classname var)
{
//classname localvar = var;
......
}
--- End code ---
correct me if I am wrong,thanks.
oBFusCATed:
Why do you care?
Some people say that the second way of doing it might be faster ( http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/ ).
blueshake:
Thanks for your reply. :D
I am going to rewrite the cc search function,but I see that in some funciton body it make a copy for the function arguments,I dont know why it was used here,
e.g.
the function arguments (var) here.
is it relatived to something(like thread-safe or else)? :D
if not,I will omit it in my new cc search function. :D
Loaden:
RVO optimization capability is very limited!
thomas:
There might be no particular reason at all, or it might be not wanting to change the function's signature for SDK compatibility at a later time.
Navigation
[0] Message Index
Go to full version