Namings
Redefined external primitive types
The first character is the under-score and the other characters are lower-case
characters or underscores. For example,
typedef short _integer2; /* 2 bytes signed integer */
External structures
The first character is the underscore which means 'tag', and the other
characters are camel-case chracters without underscore. For example,
struct _IOTextLocation {
...;
};
And, I don't use typedef for structure itself.
Internal structures
The first character is the underscore which means 'tag', and the other
characters are lower-case chracters or underscores. For example,
struct _mem_debug {
...;
};
External definitions
This rule is applied to external macros or enumeration constants.
Upper-case characters and underscores are used, but the first character is not
the underscore. For example,
#define IO_END 0
Internal definitions
This rule is applied to internal macros or enumeration constants.
Upper-case characters and underscores are used, and the first character is
the underscore. For example,
#define _IO_DEFAULT_BUFFER 512
External functions
Started with lower-case characters which represent the function category,
and the other characters are camel-case characters without underscore.
For example,
int ioReadHierarchy( struct _IOContext* io, char** excl, int nexcl, char** current_key );
Internal functions
With lower-case charcters and underscores, i.e.,
void* mem_alloc( long size );
Local variables
With lower-case characters and underscores, simple and short if possible. For example,
int i, count /* or cnt */; /* an index and counter */
void* context /* or ctx */; /* a context */
Global variables
With lower-case characters and underscores, names should be clearly understood.
It is preferable to use the category name as a prefix. For example,
int dl_init_count; /* initializer counter for dynamic loader function */