SeaMonkey:MailNews:CodingStyle: Difference between revisions

Jump to navigation Jump to search
mNo edit summary
Line 34: Line 34:
  }
  }
There are quite some (old) files in our codebase which entirely adhere to the "opening curly braces go at the end of a line" style. If you do changes there, please keep the file's coding style consistent. Mixed coding styles only makes things worse.
There are quite some (old) files in our codebase which entirely adhere to the "opening curly braces go at the end of a line" style. If you do changes there, please keep the file's coding style consistent. Mixed coding styles only makes things worse.
Empty blocks, e.g. when implementing interfaces or <tt>try</tt>ing to <tt>catch</tt> exceptions, should really be empty and can go at the end of the line if needed:
// implement nsIFolderListener
var folderListener =
{
  OnItemAdded:  function(parentItem, item) {},
  OnItemRemoved: function(parentItem, item)
  {
    try
    {
      SomethingWhichThrows();
    }
    catch (ex) {}
  }
};


==== If one <tt>if</tt> branch needs braces, the other should have braces as well ====
==== If one <tt>if</tt> branch needs braces, the other should have braces as well ====
235

edits

Navigation menu