New D coding convention style guide (brace formatting)

Charles D Hixson charleshixsn at earthlink.net
Tue Aug 22 18:41:01 PDT 2006


Bruno Medeiros wrote:
> Walter Bright wrote:
>>
>> http://thc.segfault.net/root/phun/unmaintain.html
>>  From - Mon
> 
> Speaking of which (but seriously), we may not get a consensus on tabs, 
> and maybe justifiedly so, but one other thing with DMD's coding 
> convention that troubles me is the braces formatting:
> 
>     if (b)
>     {    dg();
>     return true;
>     }
> 
> ...
> ?

My personal preference is:
      if (b)
      {    dg();
           return true;
      }
with all the indentations managed by tabs, so you can decide 
how much indenting you find useful.  (I normally choose 3 
spaces...but there are times when I compress it down to two, 
and I used to usually use 4 spaces.)

I'd be surprised if this was the most common choice, however.



More information about the Digitalmars-d-announce mailing list