Boost logo

Boost :

Subject: Re: [boost] underscores in private class member names (was: [local] this_ or _this?)
From: Julian Gonggrijp (j.gonggrijp_at_[hidden])
Date: 2011-05-19 18:40:21


Stewart, Robert wrote:

> Distinguishing private data members from local variables and formal parameters is useful. It creates a distinct "namespace" from local variable and formal parameter names. How to mark them is purely subjective. Some use the "m_" prefix, popularized by MFC and MSVC code generators, but I find that to be too much of a wart on the name. Some use "this->" as a prefix, so their data member names need no special marking.
>
> I like to distinguish protected and private data members but with a trailing underscore. I use a trailing underscore because it is less important than the data member's name. (I also use a preceding underscore for formal parameters to give them another "namespace." In that case, the underscore can't be on the end, of course.)

Joshua Juran wrote:

> I precede data member names with 'its_' (for nouns) or 'it_' (for boolean properties), e.g. its_window, it_is_selected. I chose third-person usage (as opposed to, say, "my") to match 'this'. I like self-documenting English notation. :-)

Thank you for your opinions on this matter.

-Julian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk