L
LuB
Hi,
I wanted to use the most efficient argument passing method. I was
always taught that its best to pass (const SomeObject& obj) if possible
.... but in this case, I can't pass a const param since I will be
modifying the parameter in the function.
Eg: 1
void foo(SomeObject& obj)
{
obj.doSomething();
}
or Eg: 2
void foo(SomeObject* obj)
{
obj->doSomething();
}
Aside from the NULL PTR safety of the reference version, is there a
performance advantage in the way the function and parameters are
placed/copied onto the stack for either version?
Thanks,
-Luther
I wanted to use the most efficient argument passing method. I was
always taught that its best to pass (const SomeObject& obj) if possible
.... but in this case, I can't pass a const param since I will be
modifying the parameter in the function.
Eg: 1
void foo(SomeObject& obj)
{
obj.doSomething();
}
or Eg: 2
void foo(SomeObject* obj)
{
obj->doSomething();
}
Aside from the NULL PTR safety of the reference version, is there a
performance advantage in the way the function and parameters are
placed/copied onto the stack for either version?
Thanks,
-Luther