|
Revision 262, 0.9 KB
(checked in by goodea, 4 years ago)
|
|
eol
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | CMUcam3 Coding Conventions |
|---|
| 2 | |
|---|
| 3 | 1) private functions shall start with _ |
|---|
| 4 | 2) prefix cc3_ or _cc3_ before any cmucam related functions or data types |
|---|
| 5 | 3) defines and constants will have CC3_ prefixed |
|---|
| 6 | 4) all lower case separated by _ for functions |
|---|
| 7 | 5) try to avoid abrv. |
|---|
| 8 | 6) all types end with _t |
|---|
| 9 | 7) byte order is little endian |
|---|
| 10 | 8) Use C99 types |
|---|
| 11 | #include <stdint.h> |
|---|
| 12 | #include <stdbool.h> |
|---|
| 13 | bool // boolean |
|---|
| 14 | int8_t |
|---|
| 15 | int16_t |
|---|
| 16 | int32_t // signed int |
|---|
| 17 | int64_t |
|---|
| 18 | |
|---|
| 19 | uint8_t // as a "BYTE" value |
|---|
| 20 | uint16_t |
|---|
| 21 | uint32_t // unsigned int |
|---|
| 22 | uint64_t |
|---|
| 23 | |
|---|
| 24 | float // at the mercy of the compiler no hardware support |
|---|
| 25 | double // at the mercy of the compiler no hardware support |
|---|
| 26 | |
|---|
| 27 | void* // instead of char* |
|---|
| 28 | char // for text characters |
|---|
| 29 | |
|---|
| 30 | 9) use the following gnu INDENT options: |
|---|
| 31 | indent -br -brs -nut -npsl -i2 source_name.c |
|---|
| 32 | 10) indent each level 2 more spaces than previous |
|---|
| 33 | 11) Don't put else on the same line of if |
|---|
| 34 | if (condition) foo (); else bar (); /* Yuck! */ |
|---|