---- [[PageOutline(1-6,,inline)]] ---- = Coding Style = #style == How MoleCuilder code should look like == #style-file Below you find a brief but hopefully complete list on how the code of espack should look like: * identate by two spaces, never tabs * Code Style from Eclipse, see [attachment:ESPACK_codestyle.xml]: {{{ /* * A sample source file for the code formatter preview */ #include class Point { public: Point(double xc, double yc) : x(xc), y(yc) { } double distance(const Point& other) const; double x; double y; }; double Point::distance(const Point& other) const { double dx = x - other.x; double dy = y - other.y; return sqrt(dx * dx + dy * dy); } }}} = Coding hints = #code == Some hints on good code vs. bad code == #code-good-bad === end of stream checking === #code--good-bad_eof Using {{{ std::inputstream in; while (!in.eof()) { .. } }}} is bad. Rather one should use {{{ std::inputstream in; while (in.getline(...)) { .. } }}} or {{{ std::inputstream in; for(int j; in >> j;;) { .. } }}} or {{{ std::inputstream in; in >> j; if (in.fail()) .. }}} This involves some extra typing but ensures that in case of faulty streams the error is properly pointed at.