[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5741 - GNUnet
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5741 - GNUnet |
Date: |
Fri, 23 Nov 2007 04:22:59 -0700 (MST) |
Author: grothoff
Date: 2007-11-23 04:22:59 -0700 (Fri, 23 Nov 2007)
New Revision: 5741
Added:
GNUnet/HACKING
Log:
codingstandard
Added: GNUnet/HACKING
===================================================================
--- GNUnet/HACKING (rev 0)
+++ GNUnet/HACKING 2007-11-23 11:22:59 UTC (rev 5741)
@@ -0,0 +1,40 @@
+NEW naming conventions for GNUnet:
+
+1) All exported symbols (function names, macros and structures) should begin
+ with the prefix "GNUNET_". No global variables should be exported.
+ Accepted exceptions (for now, to be reconsidered):
+ a) This rule only applies to exported symbols in normal shared libraries.
+ For all plugins, the exported symbols must end in "_libraryname" (and
+ follow other conventions as established by the plugin API). Plugins
+ should avoid exporting symbols other than those used by the plugin API.
+ b) Error handling and logging functions have the prefix "GE_" (for now).
+ c) Configuration functions have the prefix "GC_" (for now).
+ d) Certain very specific libraries (ECRS, FSUI, DHT) have their own
+ prefix. This can be ok if the prefix alone is long enough and the
+ library is highly application specific.
+2) All function names should use lower-caps names with underscores. Common
+ abbreviations like "RSA" should be in all-caps in function names. Example:
+ "GNUNET_semaphore_create".
+3) All macros and constants (including values in enums) should be in all-caps,
+ exceptions are allowed if the MACRO is really used like a normal function
+ in the rest of the application.
+4) All structs should not have underscores (other than the underscore in
+ the prefix "GNUNET_") and instead use capitalization of the first letter
+ of every word, for example "GNUNET_HashCode" (this should be the only
+ minor departure from GNU's general conventions).
+5) All local symbols (anything declared "static") should follow the same
+ conventions (except for the "GNUNET_" prefix).
+6) Global symbols that are exported but should not usually be used directly
+ (i.e., because a convenience macro is provided), should end with an
underscore.
+
+NOTE:
+=====
+
+The existing codebase does not yet follow these conventions in many
+places (especially with respect to local symbols). libgnunetutil.so
+should be clean. Patches to fix things are welcome.
+
+Also, we should have a naming convention for fields of a struct.
+Using the simple no-caps with underscores notation that is also
+used for local functions would make sense.
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5741 - GNUnet,
gnunet <=