This version is outdated by a newer approved version.DiffThis version (2017/03/25 15:23) is a draft.
Approvals: 0/1

This is an old revision of the document!


Code formatting conventions

Wiki

To insert code, use the <code cpp> tag.

Casing

  • Macros : SCREAMING_SNAKE_CASE
  • Structures / Classes / Types : PascalCase
  • Variables / Fields : camelCase

Indentation

Thou shalt in all your code use the Allman's style brace indentation.

struct MyStruct
{
    int32_t uselessField;
    uint16_t anotherUselessField;
}

Type names

When defining fields of number type, you must use the types defined in stdint.h :

SpecifierSigningBitsBytesMinimum ValueMaximum Value
int8_tSigned 8 1−27 which equals −12827 − 1 which is equal to 127
uint8_tUnsigned 8 1028 − 1 which equals 255
int16_tSigned 16 2−215 which equals −32,768215 − 1 which equals 32,767
uint16_tUnsigned 16 20216 − 1 which equals 65,535
int32_tSigned 32 4−231 which equals −2,147,483,648231 − 1 which equals 2,147,483,647
uint32_tUnsigned 32 40232 − 1 which equals 4,294,967,295
int64_tSigned 64 8−263 which equals −9,223,372,036,854,775,808263 − 1 which equals 9,223,372,036,854,775,807
uint64_tUnsigned 64 80264 − 1 which equals 18,446,744,073,709,551,615
wiki/conventions.1490451811.txt.gz · Last modified: 2017/03/25 15:23 (external edit)
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0