On Mar 26, 2009, at 4:40 PM, Jay Pipes wrote:

Style #4:

Have a style you prefer? :)

It is ugly, but it really is the best method!

Prefix class variables with a unique prefix. For example:

class Diagnostics_area
{
...
 /** Message buffer. Can be used by OK or ERROR status. */
 char da_buffer[DRIZZLE_ERRMSG_SIZE];
...
}

This helps you find all reference to this variable in the entire program. In the example above you can quickly find all usages of the Diagnostics_area buffer (as apposed to 100s of buffers in other classes and structures).

I have some experience with this, and I can confirm that, when fixing a bug, or just trying to understand the code (even your own code), it is _EXTREMELY_ useful.


Personally, I am a fan of using a single underscore prefix for
designating private members.  I personally find it makes it easy to
differentiate private local member variables of a class with global
variables (and there are a ton of them...) outside of the class itself.

But, we want to hear folks' thoughts on this.

Do you have a favorite style?



--
Paul McCullagh
PrimeBase Technologies
www.primebase.org
www.blobstreaming.org
pbxt.blogspot.com




_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to