diana:diana_codestyle

This is an old revision of the document!


Code style

  • Code style for Eclipse:code style
  • Use single blank lines
  • Use doxygen (java or c++)
  • Always use downcase in namespace
  • Space after semicolon in for-loops etc.
  • Space before and after assignment operators

… and follow the example below …

namespace metno {

const int DEFAULT_NUMBER = 1;

/**
 * A sample source file for the code formatter preview
 */
class Point {
public:
  /**
   * @param xc bla bla
   */
  Point(double xc, double yc) : x(xc), y(yc) { }

  Point(double yc) : y(yc) 
  {
    if (true) {
      
    } else if (false) {
      
    }
    for (int i = 0; i < yc; ++i) { ///< space etter ;
      int j = 0;
    }

  }
  
  /**
   * Description of distance
   */
  double distance(const Point& other) const;
  int minParam;
  double x; ///< a doxygen comment on dx
  double y;
  char *hello;
  Point& p;

  /// Enum description
  enum MyEnum {ONE, TWO, THREE};

};

double Point::distance(const Point& other) const {
  double dx = x - other.x;
  LOG4CXX_DEBUG(logger,"");
  double dy = y - other.y; // comment
  return sqrt(dx * dx + dy * dy);
}

} // end namespace metno
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • diana/diana_codestyle.1228312164.txt.gz
  • Last modified: 2022-05-31 09:23:14
  • (external edit)