Indenting standards religions K&R, whitesmiths etc

Cecil Ward cecil at cecilward.com
Wed May 31 16:24:38 UTC 2023


I wanted to ask how some of the leaders of our group feel about D 
indentation standards. `i realise that this causes some religious 
fervour in C. I could be in trouble here because in all my years 
at work, we never used K & R ‘one true brace style’ indenting, 
with the house style I’m used to being more like whitesmiths. 
Wikipedia explains this better. Something like the following 
below.

So my question: would I get lynched for the following? (below)

And can anyone recommend a beautifier / pretty printer tool for D 
that is customisable to your house style if that is a thing 
that’s needed? I assume I would need that if I were to donate 
code, unless some helpful recipient would run such a tool on .d 
files received.

—

pure nothrow etc
T
foo( T, T2 )(
         in T param x,
         in T2 param y
         )
             if ( template-qualification-whatever )
in     {
         static assert( … );
         }
out ( ret )
         {
         …
         assert( test ret );
         }
do   {
         blah
         if ( test ) {
                 …
                 if-body
                 …
                 }
         back to main block
         …
         …
         } /* end of function, notice the indent level stays out 
with the content */


More information about the Digitalmars-d-learn mailing list