Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualTheChubu

Posted 17 April 2013 - 07:52 PM

I always look at control blocks with one line, no braces and think "Someday I'm going to mess this up" So I always put braces even if the if/else block can fit in a single line.

 

Something I took from Id Software coding style manual is the spacing between parenthesis, ie:

 

if ( this.vertexBuffer == null )

if ( enable )

if ( this.dirty )

 

And so on. Its more pleasing to the (my) eye.

 

Sometimes, if the conditions are many I treat the parenthesis as if it were another curly braces block like this:

 

mode = modeArray[i];
if
( 
    mode.getWidth() == width &&
    mode.getHeight() == height &&
    mode.getFrequency() == 60 &&
    mode.getBitsPerPixel() == 32
)
{
    Display.setDisplayMode(mode);
    break;
}
 
This one I haven't seen it elsewhere yet.

#3TheChubu

Posted 17 April 2013 - 07:51 PM

I always look at control blocks with one line, no braces and think "Someday I'm going to mess this up" So I always put braces even if the if/else block can fit in a single line.

 

Something I took from Id Software coding style manual is the spacing between parenthesis, ie:

 

if ( this.vertexBuffer == null )

if ( enable )

if ( this.dirty )

 

And so on. Its more pleasing to the (my) eye.

 

Sometimes, if the conditions are many I treat the parenthesis as if it were another curly braces block like this:

 

mode = modeArray[i];
if
( 
    mode.getWidth() == width &&
    mode.getHeight() == height &&
    mode.getFrequency() == 60 &&
    mode.getBitsPerPixel() == 32
)
{
Display.setDisplayMode(mode);
break;
}
 
This one I haven't seen it elsewhere yet.

#2TheChubu

Posted 17 April 2013 - 07:51 PM

I always look at control blocks with one line, no braces and think "Someday I'm going to mess this up" So I always put braces even if the if/else block can fit in a single line.

 

Something I took from Id Software coding style manual is the spacing between parenthesis, ie:

 

if ( this.vertexBuffer == null )

if ( enable )

if ( this.dirty )

 

And so on. Its more pleasing to the (my) eye.

 

Sometimes, if the conditions are many I treat the parenthesis as if it were another curly braces block like this:

 

mode = modeArray[i];
if
( 
    mode.getWidth() == width &&
    mode.getHeight() == height &&
    mode.getFrequency() == 60 &&
    mode.getBitsPerPixel() == 32
)
{
Display.setDisplayMode(mode);
break;
}
 
This one I haven't seen it elsewhere yet.

#1TheChubu

Posted 17 April 2013 - 07:51 PM

I always look at control blocks with one line, no braces and think "Someday I'm going to mess this up" So I always put braces even if the if/else block can fit in a single line.

 

Something I took from Id Software coding style manual is the spacing between parenthesis, ie:

 

if ( this.vertexBuffer == null )

if ( enable )

if ( this.dirty )

 

And so on. Its more pleasing to the (my) eye.

 

Sometimes, if the conditions are many I treat the parenthesis as if it were another curly braces block like this:

 
mode = modeArray[i];
if
( 
    mode.getWidth() == width &&
    mode.getHeight() == height &&
    mode.getFrequency() == 60 &&
    mode.getBitsPerPixel() == 32
)
{
Display.setDisplayMode(mode);
break;
}
 
This one I haven't seen it elsewhere yet.
 
 

PARTNERS