manpagez: man pages & more
info gmsh
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

D.2 Coding style

If you plan to contribute code to the Gmsh project, here are some easy rules to make the code easy to read/debug/maintain:

  1. Please enable full warnings for your compiler (e.g. -Wall with g++) and don’t commit until there is no warning left.
  2. Use memory checking tools to detect memory leaks and other nasty memory problems. For example, you can use
    • Valgrind on Linux:
      valgrind --leak-check=yes --show-reachable=yes gmsh file.geo -3
    • GMALLOC on Mac OS X:
      (gdb) set env DYLD_INSERT_LIBRARIES /usr/lib/libgmalloc.dylib
      kill -USR1
    • Purify
    • Memprof
  3. always use the Msg:: class to print information or errors
  4. indent your files (2 spaces) and convert all tabs to spaces
  5. follow the style used in the existing code when adding something new (spaces after commas, opening braces for functions on a separate line, opening braces for loops and tests on the same line, etc.)

This document was generated on February 9, 2014 using texi2html 5.0.

© 2000-2018
Individual documents may contain additional copyright information.