[gmpi] Re: Coding Conventions

  • From: Tim Hockin <thockin@xxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Thu, 10 Feb 2005 10:41:06 -0800

On Thu, Feb 10, 2005 at 01:36:40PM -0500, Ron Kuper wrote:
> >>>
> by the convention that you should *always* reference a member variable
> canonically:  this->count
> 
> Not doing so just makes code harder to read, imho.
> <<<
> 
> No C++ practitioner writes code this way.  Simply isn't done in
> practice.  Too much typing, too much clutter.

That may be true, but then those practitioners can deal with the problems.
I don't have any.  

Seriously, when one chooses to ignore a perfectly valid (and arguably
self-documenting) way of avoiding a problem, can you feel bad for them?

This being an API, we should be as explicit as possible at all turns.
I've been tracking a thread recently of people being bitten by some
bizarre rules of templatized classes being subclassed, where subclass
methods are not finding members of the parent class.  Apparently this is
"correct".  It never would have happened if people did not imply "this->".

I've also been burned by hierarchical scope in other languages, and I
won't do it again.  Too many hours wasted.  If I am referring to a member
of an object, it gets a fully-qualified name.

> >>> 
> structs are always "struct foo", unless it is truly opaque.
> <<<
> 
> And would class be "class foo"?  That seems to deprecate user-defined
> types as second class citizens.

I'm frequently torn about typedefs.  As much as I evangelize lower case, I
tend to make classes start with an upper case.

----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: