Skip to main content
1 of 4
ggrr
  • 5.9k
  • 11
  • 39
  • 38

Is readability a valid reason to NOT using const in parameters?

When writing some functions, I found a const keyword in parameters like this:

void MyClass::myFunction(const MyObject& obj,const string& s1,const string& s2,const string& s3){ } 

often causes splitting a line into 2 lines in IDE or vim, so I want to remove all const keywords in parameters:

void MyClass::myFunction(MyObject& obj,string& s1,string& s2,string& s3){ } 

is that a valid reason to not using const? Is it maintainable to keep the parameter objects unchanged manually?

ggrr
  • 5.9k
  • 11
  • 39
  • 38