[CTRL++] Pass value as constant reference if it is not changed in the function
Passing values as reference is faster than passing them as a copy (call by value, call by reference), if variables are passed as reference, the content is able to change and return to the calling function, if a function is not intended to change the content when values are passed as reference. The reference should be passed as const to prevent changes which are not intentional. This is also applicable for CONTROL.
main{ dyn_dyn_anytype dda; //fill dda with a lot of elements...; printData(dda);}printData(const dyn_dyn_anytype &dda){ //print dda data...}
Date added:
Last revised:
Hits:
10.859
Rating:
Tags:
Programming / Scripting, OOP