Naming Conventions for Functions and Files
While file-naming conventions are not always practical, they can be very
useful. The most important naming convention used by the client source
is prefixing a function name with an abbreviation of the module in which
the function resides. For example, all public functions in the networking
library have names that begin with NET_. Typically, functions
private to a module have the same prefix, but the characters in the abbreviation
are all lowercase, as opposed to all uppercase for exported functions.
Here is a list of common prefixes:
module |
prefix |
layout engine |
LO_ |
parser |
PA_ |
networking library |
NET_ |
"front end" (platform specific) |
FE_ |
image library |
IL_ |
connection to java layer |
LJ_ |
compositor |
CL_ |
cross-platform utilites |
XP_ |
OS level utilites |
PR_ |
The use of prefixes offers two main advantages:
-
Module-specific prefixes before function names prevents name collisions
between functions in different modules.
-
When looking at a stack trace, programmers can quickly tell where to begin
debugging.
Here are two examples of file naming conventions currently in use:
libmocha filenames begin with lm_*.c, and layout filenames
begin with lay*.c.
Copyright © 1998
Netscape
Communications Corporation