garrynewman / GWEN

Abandoned: GWEN - GUI Without Extravagant Nonsense.
MIT License
428 stars 102 forks source link

Coding Standards? #40

Open DeeKayHT opened 11 years ago

DeeKayHT commented 11 years ago

I was wondering if there is any coding standard that you'd like us to conform to when making commits to the GWEN code. I noticed some recent code that was merged in had inconsistent if/else statements and had converted tabs into spaces.

jeremieroy commented 11 years ago

That may comes from me. I agree that a coding standard would be great. Also a bit of doc about some of the design philosophy would help as well. (Mostly about layouting) What about activating the wiki ?

billyquith commented 11 years ago

Coding standards would be good to set the formatting in stone. But could we please have formatting that looks like other C++. If GWEN is going to be constantly reformatted, I may just fork it, or find another solution.

I work on a laptop a lot (13" screen) so I like space saving "narrower" code. Line length max 100?

Can we please avoid idomatic formatting (which also confuses editors because the brackets don't match):

if ( foo == 7 )
{ doSomething(); }

One of:

if ( foo == 7 ) { doSomething(); }

if ( foo == 7 ) {
    doSomething();
}

if ( foo == 7 )
{
    doSomething();
}

And there is nothing wrong with:

if ( foo == 7 )
    doSomething();

or:

switch ( test )   // This is easier to read on a 13" laptop, and easier to see all values
{
    case A: value = 1; break;
    case B: value = 2; break;
    case C: value = 3; break;
    case D: value = 4; break;
}

not:

switch ( test )  
{
    case A:
        value = 1;
        break;

    case B:
        value = 2;
        break;

    case C:
        value = 3;
        break;

    case D:
        value = 4;
        break;
}
billyquith commented 11 years ago

Also, there seem to be quite a few warnings in the code (signed/unsigned, _s etc). I think these are priority over fixing the formatting.

jeremieroy commented 11 years ago

Well, at this stage, it would be great to have a feedback from Garry :) We should try not to be emotional about decision and keep it friendly. But we need to have decision ... (Hi Garry !)

garrynewman commented 11 years ago

I thought the code formatting was pretty obvious from looking at all of the other existing code. ie lots of spacing, no Egyption bracketing etc.