Motion for code style guideline change

Current standardised syntax:

do 
{
//code
} while (condition)

Proposed standardised syntax:

do
{
//code
}
while (condition)

Reason: This is the only inconsistency we have in our current set of guidelines. This is the only rule that defines curly brackets and C++ keywords to be on the same line.

Background IRC transcript:

[20:54] style nazi question:

[20:54] }

[20:54] while()

[20:54] or

[20:54] } while()

[20:54] second

[20:55] leak: that one even is here http://www.trinitycore.org/f/index.php?/topic/6-trinitycore-developing-standards/

[20:56] what

[20:56] formal protest /emoticons/default_tongue.png

[20:56] heh

[20:56] i set that.

[20:56] I think the former looks cleaner

[20:57] since we don’t have if () { /n

[20:57] //code

[20:57] }

[20:57] either

[20:57] we have: if () /n

[20:57] {

[20:57] //code

[20:57] }

[20:57] its just the do/while one /emoticons/default_biggrin.png

[20:57] because the while is part of the loop, not after the loop (like if/else)

[20:58] i liek pie

[20:58] and putting * on variables

[20:58] * leak watches the madness unfold

[20:58] yeah, but in any other established standard, we don’t have keywords and curly brackets on the same line /emoticons/default_tongue.png

[20:58] true, this one just felt… natural

[20:58] it doesn’t for me /emoticons/default_sad.png

[20:58] unlike all others

Anyway that kind of writing doesn’t matter to me.

But if you do have text after brakets on the actual code style, it seems to be fair to have also before.

ex:


do {

// code

} while (condition)

I do that on php. It seems to me to be more easy to read.

same as Machiavelli:

there is no

[CODE]if () {

//code

}[/CODE]

but

[CODE]if ()

{

//code

}[/CODE]

it should look like this indeed /emoticons/default_smile.png

I would make a standard for writing long conditions or too much parameters too, I mean:


if (

    conditionA ||

    conditionB ||

    conditionC 

)

{

    ptr->function(

        paramA,

        paramB,

        paramC,

        paramD

    );

    //code

}

else

{

    //code

}

… some people just don’t like it, but it’s really appropriate, especially

when the core has too much parametrized functions, the idea is:

" more lines to decrease width of the code rather than horizontal scroll bar "

what do you say ? /emoticons/default_wink.png

This poll is only for do / while. Please open another topic for additional code style changes.

– Brian

Didn’t even realize I posted it in the public section /emoticons/default_tongue.png. But it’s a good thing to get input from the rest of the community. Thanks for the replies so far.