Re: GTK+ policy




    Kristian> To add to this, it does not specify how to deal with braces in
    Kristian> nested if-statements.  When I start to nest if-statements (also
    Kristian> with a single-statement body) I typically start adding braces,
    Kristian> because it is a bit clearer and avoids the dangling else problem.

    Some advices similar to yours are provided in the Gnu coding standards: 
    http://www.gnu.org/prep/standards/standards.html#Formatting:

When you have an if-else statement nested in another if statement, always put braces around the if-else. Thus, never write like this:

if (foo)
  if (bar)
    win ();
  else
    lose ();

always like this:

if (foo)
  {
    if (bar)
      win ();
    else
      lose ();
  }



    
    


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]