Another-Game-Engine / AGE

AGE - C++11 OpenGL4 Game Engine
MIT License
49 stars 11 forks source link

Remove all useless return this #499

Open cesarl opened 9 years ago

cesarl commented 9 years ago

@DorianPinaud add a lot of of useless return this. That's beautiful but totaly useless and complicate the code for nothing.

For example

Toto &Toto::DoSomething()
{
// do stuff
return *this;
}

replace it by normal code

void Toto::DoSomething()
{
    //do stuff
}

You will find a lot of code like that in graphical parts

DorianPinaud commented 9 years ago

I don't think that a return is a complicated thing and It allows to chain your operation.

cesarl commented 9 years ago

I ask for a vote !!! Hahaha !!! (Honnêtement c'est juste parce que je trouve ça moche et que je cherchais des tâches de clean pour Lolo, mais si vous avez de meilleurs idées n'hésitez pas ! )

Le jeu. 2 juil. 2015 20:04, DorianPinaud notifications@github.com a écrit :

I don't think that a return is a complicate thing and It allows to chain your operation.

— Reply to this email directly or view it on GitHub https://github.com/Another-Game-Engine/AGE/issues/499#issuecomment-118197623 .

ghost commented 9 years ago

J'aurai tendance à dire que ce n'est pas moche. Quand une fonction initialement void peut se montrer utile en retournant une information supplémentaire (que l'utilisateur n'est pas obligé de récupérer) ça me semble plutôt bien. Et pour le compte un return *this; ne nuit pas à la lisibilité du code. Du coup pour ce cas là je rejoins plutôt Dorian.