Frage

when using default parameter, I set

void method1(float v, float w =1.0)

Is this a good practice to use the comment in the definition like

void class::method1(float v, float w /*=1/0*/)
War es hilfreich?

Lösung

I would prefer some doxygen compliant documentation this way:

/**
 * Description of the behavior/purpose of your method
 * 
 * @param v The float 'v' (whatever this means)
 * @param w Optional float 'w' (whatever this means), default value is 1.0.
 */
void method1(float v, float w =1.0);

Usually I'm not going to put additional comments with implementation specific blocks,

Andere Tipps

Intellisence in most of the IDE will work, if not you can keep comment as well. I do not think any harm in this.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top