Is using underscore suffix for members beneficial?

后端 未结 13 2194
猫巷女王i
猫巷女王i 2020-12-29 03:58
class C {
 private:
  int member_; // here is the underscore I refer to.
}

This underscore is recommended by Google Style Guide and Geosoft\'s C++

13条回答
  •  情话喂你
    2020-12-29 04:28

    I agree with you that the underscore variable suffix is not the ideal coding style, and that adding a little complexity into the constructor is better than adding more complexity throughout the entire class.

    The other day, I took a look at one of my old Java projects where I had applied the underscore suffix to variable names, and I found that it did make reading the code more difficult. It wasn't too hard to get used to, but I found it to be slightly distracting without adding any real benefit.

提交回复
热议问题