Trailing underscores for member variables in C++

前端 未结 7 473
后悔当初
后悔当初 2020-12-13 03:46

I\'ve seen people use a trailing underscore for member variables in classes, for instance in the renowned C++ FAQ Lite.

I think that it\'s purpose is not to mark var

7条回答
  •  猫巷女王i
    2020-12-13 04:19

    I am personally a big fan of this guideline: http://geosoft.no/development/cppstyle.html

    It includes omitting the m_ prefix, using an underscore suffix to indicate private member variables and dropping the horrid, annoying-to-type habit of using underscores instead of space, and other, more detailed and specific suggestions, such as naming bools appropriately(isDone instead of just done) and using getVariable() instead of just variable() to name a few.

提交回复
热议问题