[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:
Rating: 3.8. 36 vote(s). No rating done at all.
Your vote was '' (0 of 5) Your are an anonymous user.
You may log on to do personalized votings
Click the rating bar to rate this item Please log on to do ratings
Programming / Scripting, OOP