Coding Style in SILC source tree
================================
-This documents describes the coding style and coding conventions used
+This document describes the coding style and coding conventions used
in the SILC source tree. The purpose of the document is to describe the
common way to program for SILC and thus should be learned when programming
new code. The document describes various conventions regarding variable
have a pretty good idea what you are programming and what the module
does. For example, <cipher>, <config>, <command>, <packet>, etc.
-The <function> is the describtion of the functionality of the function
+The <function> is the description of the functionality of the function
you are writing. Naturally it should be self explanatory and weird
short names should be avoided. It is better to have long function
names than some odd name that does not tell what it is about. Function
o If you are not sure about how something should be done or
the code you've done is not finished, it should be commented
- with XXX plus explanation what is going on.
+ with XXX plus explanation what is going on. For example,
+ /* XXX hmm... how is this flushed? */
Source Files
public prototypes of the functions. Go see any header file as an example.
+Using gotos
+===========
+
+Gotos are used in the SILC code quite often. If you know how to use
+goto's properly then it is ok to use them for example to optimize the
+code. However, if you don' know how to use goto's do not use them.
+
+
Debug Messages
==============
memset(ptr, 'F', sizeof(*ptr));
silc_free(ptr);
-Where 'F' indicates free'd memory if you ever check it with debugger.
+Where 'F' indicates free'd memory if you'd ever check it with debugger.
Other choice is to use 0 instead of 'F'. The pointer after freeing
should be set to NULL if appropriate, ptr = NULL.
Note that some functions in the SILC library handles the zeroing of
the memory area automatically, like for example, silc_buffer_free.
+Also note that all allocation routines assert()'s if the memory allocation
+fails, ie. system does not have free memory.
+
Callback Programming
====================