local variable naming convention

Jonathan M Davis jmdavisProg at gmx.com
Fri Dec 20 02:06:10 PST 2013


On Friday, December 20, 2013 10:30:06 bearophile wrote:
> kdmult:
> > this(int x, int y)
> > {
> > 
> >    this.x = x;
> >    this.y = y;
> > 
> > }
> 
> In D I prefer:
> 
> this(int x_, int y_) {
>      this.x = x_;
>      this.y = y_;
> }

Whereas I put the underscore before (e.g. _x), and some folks like to do m_x 
(though I haven't seen many people do that in D - more in C++). It doesn't 
really matter. But the typical naming conventions have types being 
PascalCased, and everything else being camelCased, so naming any variables 
with PascalCasing (or simply making them all uppercase) is definitely not the 
typical thing to do in D.

http://dlang.org/dstyle.html

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list