New D coding convention style guide (brace formatting)

Ivan Senji ivan.senji_REMOVE_ at _THIS__gmail.com
Mon Aug 21 07:33:41 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;
>     }
> 
> .... whoa :/ . Where did that come from? It's unusual 

It sure is!

> (I personally have 
> never seen C-family code formatted that way), and seems awkward to me. 
> How about:
> 
>     // BSD/Allman style
>     if (b)
>     {
>     dg();
>     return true;
>     }
> 
> or (my preference) :
>     // K&R style
>     if (b) {
>         dg();
>         return true;
>     }
> ?

No, No!
Everyone knows it should really be:

if(b)
{
   dg();
   return true;
}

;) :P



More information about the Digitalmars-d-announce mailing list