| The discussion about coding style on the net-snmp-coders mailing list |
| can be found at the following web address: |
| http://www.geocrawler.com/mail/thread.php3?subject=design+proposal+-+coding+style&list=6845 |
| |
| ---------------------------------------------------------------------- |
| Indentation: |
| |
| We've adopted the following indent style: |
| |
| indent -orig -nbc -bap -nut |
| |
| If possible, please run all new code submitted to the project through |
| the above command. However, if sending a patch, please do *not* send |
| a patch that reformats the entire file. Just the new sections of code |
| should be in the above style to make it easier for us to dissect what |
| you did in your patch. |
| |
| Briefly, here's a description of the style: |
| |
| Blank lines: |
| after procedures |
| not (forced) after blocks of declarations or block comments |
| multiple declarations not split onto separate lines |
| |
| Comments: |
| Block comments indented 4 spaces from surrounding code |
| Start/End on separate lines |
| Solid '*' on the left of block comments |
| "One-line" comments start in column 33 |
| |
| Bracing/Indent/etc: |
| K&R-style bracing (including "cuddle-else") |
| 'case' statements in line with 'switch' |
| No space between procedure name and opening parenthesis |
| variable declarations lined up, and start in column 16 |
| Procedure return type on a separate line to the procedure name |
| Four character basic and continuation line indent |
| No tabs used in the file, always use 8 spaces instead. |
| Continuation paramters lined up with opening parenthesis |
| |
| ---------------------------------------------------------------------- |
| Function names and Variable names: |
| |
| should_be_like_this and notLikeThis |
| |
| ---------------------------------------------------------------------- |
| Structures: |
| |
| We have decided to typedef all structures into names using the |
| following convention: |
| |
| typedef struct netsnmp_wombat_s { |
| int something_cool; |
| } netsnmp_wombat; |
| |
| The important things to note here are that the struct name ends in a |
| "_s", the typedef name doesn't end in "_t", and the typedef is not to a |
| pointer and everything begins with "netsnmp_". |