root/trunk/docs/coding_conventions.txt

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 
1CMUcam3 Coding Conventions
2
31) private functions shall start with _
42) prefix cc3_ or _cc3_ before any cmucam related functions or data types
53) defines and constants will have CC3_ prefixed
64) all lower case separated by _ for functions
75) try to avoid abrv.
86) all types end with _t
97) byte order is little endian
108) 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
309) use the following gnu INDENT options:
31        indent -br -brs -nut -npsl -i2 source_name.c
3210) indent each level 2 more spaces than previous
3311) Don't put else on the same line of if
34        if (condition) foo (); else bar ();     /* Yuck! */
Note: See TracBrowser for help on using the browser.