Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Function Declaration Parameter Naming Best Practices (C++)

Tags:

c++

function

In a function declaration, while the parameters do not have to be named, is it preferable to have them named? What are the advantages and disadvantages of this?

like image 954
pingu Avatar asked Dec 07 '22 17:12

pingu


2 Answers

The advantage of naming them is that you can refer to them in the documentation. (This includes your editor/IDE picking them up and presenting them to you as hints when you type a call to such a function.)

A disadvantage would be that names might change according to the function's implementation, except for the fact that the names in a function declaration might differ from those in the function's definition. (IOW: I see no disadvantage.)

like image 88
sbi Avatar answered Dec 09 '22 05:12

sbi


For documentation reasons mainly

like image 40
James Avatar answered Dec 09 '22 06:12

James