aboutsummaryrefslogtreecommitdiffstats
path: root/doc/CODING-GUIDELINES
diff options
context:
space:
mode:
authorcitats <citats@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-02 19:24:05 +0000
committercitats <citats@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-02 19:24:05 +0000
commit75a0cc8b77f46f8e6017b158d60c24abfd73aa89 (patch)
tree1cb8ffa29ad2a0ad64f0a96c250970cb60054635 /doc/CODING-GUIDELINES
parenteae2e282472b4c2d73e90d946ab858f1b7494b77 (diff)
Add doc/CODING-GUIDELINES document
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2863 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'doc/CODING-GUIDELINES')
-rwxr-xr-xdoc/CODING-GUIDELINES53
1 files changed, 53 insertions, 0 deletions
diff --git a/doc/CODING-GUIDELINES b/doc/CODING-GUIDELINES
new file mode 100755
index 000000000..7d621b48d
--- /dev/null
+++ b/doc/CODING-GUIDELINES
@@ -0,0 +1,53 @@
+Asterisk Patch/Coding Guidelines
+
+To be accepted into the codebase, all non-trivial changes must be
+disclaimed to Digium or placed in the public domain. For more information
+see http://bugs.digium.com
+
+Patches should be in the form of a unified (-u) diff.
+
+Don't annotate your changes with comments like "/* JMG 4/20/04 */";
+Comments should explain what the code does, not when something was changed
+or who changed it.
+
+Don't make unnecessary whitespace changes throughout the code.
+
+Don't use C++ type (//) comments.
+
+Try to match the existing formatting of the file you are working on.
+
+Functions and variables that are not intended to be global must be
+declared static.
+
+Function calls and arguments should be spaced in a consistent way across
+the codebase.
+GOOD: foo(arg1, arg2);
+GOOD: foo(arg1,arg2); /* Acceptable but not preferred */
+BAD: foo (arg1, arg2);
+BAD: foo( arg1, arg2 );
+BAD: foo(arg1, arg2,arg3);
+
+Following are examples of how code should be formatted.
+
+Functions:
+int foo(int a, char *s)
+{
+ return 0;
+}
+
+If statements:
+if (foo) {
+ bar();
+} else {
+ blah();
+}
+
+Case statements:
+switch (foo) {
+ case BAR:
+ blah();
+ break;
+ case OTHER:
+ other();
+ break;
+}