I have some code: here that I am compiling with -Weffc++ -Wall -Wextra.
I can't get onlinegdb to give me the same compiler warning that I see on my linux VM. But basically I have this snippet:
test& get_test()
{
return *this;
}
and I get the warning: should return a reference to '*this' [-Weffc++]. I am not really sure what to make of that warning. I have read that this is perfectly ok (i.e. to return a deferenced this).
Is there a way I can keep my complier happy?
Aucun commentaire:
Enregistrer un commentaire