Phango - questions
Robert Fraser
fraserofthenight at gmail.com
Mon Nov 19 14:34:42 PST 2007
Bill Baxter Wrote:
> Sean Kelly wrote:
> > Christopher Wright wrote:
> > > This is
> >> a stylistic topic that almost no one touches, probably because Tango
> >> conventions seem to be lifted wholesale from Java and that's how Java
> >> does it, but I find it a bit confusing and annoying when I'm reading
> >> someone else's code.
> >
> > For member variables, I personally prefix the non-public variables with
> > "m_" and non-public static member variables with "sm_".
> >
> >> I would at least prefix private variables with an underscore, if I
> >> were setting the style. But if I want to muck about with Tango's
> >> internals, I can suck it up.
> >
> > I avoid leading underscore prefixes because they are reserved for C/C++
> > standard library use. It's easiest to just avoid this format entirely
> > than risk the rare chance of a collision.
>
> I used to be a big 'm_' guy, but I recently started using trailing
> underscores for private members. Started doing that after porting
> OpenMesh from C++, which uses that convention. I was amazed at how much
> more readable all the code looked with the garbage characters appended
> as a suffix rather than a prefix. Apparently this style is used some by
> Boost as well as the ACE library. Trying to find out where it came from
> I ran across a quote from someone saying (in 2004) that it's "the de
> facto cool kids' C++ style". :-)
> http://discuss.joelonsoftware.com/default.asp?joel.3.49438.14
>
> I asked the original OpenMesh devs about it and one responded that he
> used to be in typography before computer science, and from what he
> learned doing that about how humans read he could say the suffix version
> is definitely going to be more readable.
>
> Just some food for thought.
>
> --bb
Why do private members need to be differentiated typographically?
More information about the Digitalmars-d
mailing list