CenterIM 5 Hacking Documentation

Contents
--------

1. Code Style
2. General Debugging
3. Valgrind Notes


1. Code Style
-------------

- No tabs, two spaces indenting.
- Line length limited to 78 characters.
- Comments:
    // one line comment
    /* Multiline
     * comment. */
- Names of classes and methods use CamelNotation, variables use
  common_c_naming. THIS_IS_A_CONST. There is an exception, libpurple/glib
  callbacks use common C naming too.
- Example of class declaration:
class MyClass
: public OtherClass
{
public:
  // enums and typedefs first,
  // then variables,
  // methods last

  /**
   * Doxygen comment.
   */
  virtual size_t GetLinesCount() const { return lines_count; }

protected:
  size_t lines_count;

private:
};
- Order methods in an implementation file according to a header file.
- Methods that can be bound to a key are prefixed with 'Action', for example,
  ActionActivate().
- Methods connected to signals should use 'On' prefix, for example,
  OnSelectionChanged().
- Singletons have got all variables private, other classes should have all
  variables protected.


2. General Debugging
--------------------

Use the '--enable-debug' configure option to disable optimizations and to
enable producing of binary with debugging information.

Use the '--enable-strict' configure option to enable extra compiler warnings.


3. Valgrind Notes
-----------------

% export GLIBCXX_FORCE_NEW=1
% export G_DEBUG=gc-friendly
% export G_SLICE=always-malloc
% valgrind --leak-check=full --child-silent-after-fork=yes \
    --log-file=cim5.log --track-fds=yes centerim5

Make sure you don't run this command on libtool's binary wrapper.

GLIBCXX_FORCE_NEW forces libstdc++ allocator to use new() and delete() calls
instead of using memory pools
(http://gcc.gnu.org/onlinedocs/libstdc++/manual/ext_allocators.html).

G_SLICE and G_DEBUG env vars make sure to turn off glib's memory
optimizations, so that they do not confuse Valgrind
(https://live.gnome.org/Valgrind).

There is currently no suppresion list, though you can use at least the list
from the Pidgin project.

