[gmpi] Re: Coding Conventions

  • From: Paul Davis <paul@xxxxxxxxxxxxxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Thu, 10 Feb 2005 13:50:20 -0500

>On Thu, Feb 10, 2005 at 12:16:42PM -0500, Ron Kuper wrote:
>> So how then in practice do you distinguish between a C++ member
>> variable, versus a local variable:
>
>by the convention that you should *always* refernce a member variable
>canonically:  this->count
>
>Not doing so just makes code harder to read, imho.

gack.

by the convention that you never use a locally-scoped variable with
the same name as a member. yeah, ok, its not a very good convention
and its gotten me into trouble a few times. but it doesn't fail very
often and there are tools to find the violations pretty easily.

seriously, the whole point of using C++ for me often comes down to
avoid this->foo! adding this-> onto every member variable would make
most of my code look like C. why bother?

> struct plugin {
>       char * plug_name;
>       int plug_foo;
>       unsigned plug_bar;
> }
>
>But I usually get shouted down :)

you old *nix-head :) 

--p

----------------------------------------------------------------------
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: