Skip to content

POSIX C

C Language Standards

Evolution of C Standards

C89 / ISO C90 (1989/1990), First standardized version of C by ANSI (C89) and ISO (C90), key features:

  • Function prototypes (stronger type checking).
  • const, volatile, and signed keywords.
  • Standard library defined (stdio.h, stdlib.h, etc.).
  • Only /* … */ style comments.
  • Identifiers: only first 6 characters of external names guaranteed significant.

C99 (1999), Introduced modern language features:

  • // single-line comments.
  • Variable-length arrays (VLAs).
  • inline functions.
  • restrict keyword for pointer aliasing optimization.
  • New data types: long long int, _Bool, complex numbers (<complex.h>).
  • Improved standard library: snprintf, flexible math functions.
  • Designated initializers and compound literals.
  • Mixed declarations and code (no longer required to declare all variables at top).
  • Wide character support (wchar_t, <wchar.h>).
  • Flexible array members in structs.

C11 (2011), Focused on concurrency, safety, and portability:

  • Multithreading support: <threads.h> library.
  • Atomic operations: _Atomic keyword and <stdatomic.h>.
  • Thread-local storage: _Thread_local.
  • Static assertions: _Static_assert.
  • Generic selections: _Generic for type-generic macros.
  • Alignment control: _Alignas, _Alignof.
  • Improved Unicode support: char16_t, char32_t.
  • Optional bounds-checking interfaces: <bounds.h>.
  • Safer programming model with clearer memory consistency rules.

References

Coding Style Guide & Formatter

Use only spaces, and indent 2 spaces at a time.

All files encoding in UTF-8, with LF line of end, except Windows BAT script.

naming rules

  • snake_case
  • camelCase
  • PascalCase
  • snakesnake: all lower and no spaces
  • snake-minus: all lower and concatenate with minus
  • SNAKE_CASE_UPPER: all upper and concatenate with underline

naming entity

entityruleexample
structurePascalCasestruct UrlTableProperties { ...}
structure data membersnake_case
variablesnake_casea_local_variable, a_struct_data_member
functionPascalCase
constantcamelCase, snake_case
macroSNAKE_CASE_UPPER#define MY_PROJECT_ROUND(x) ...
enumPascalCaseenum Status { ...}
enum data membercamelCase
typedefPascalCase
filenamesnake_case, snake-minus, snakesnake
testsnake_casefoo_test.c

OOP

| entity | rule | | ------------------ | ---------- | --------------------- | | Namespace Name | snake_case | | public function | PascalCase | | class | PascalCase | | Class Data Members | snake_case | | | variable | snake_case | a_class_data_member |

Visual Studio Code - Code formatting
https://code.visualstudio.com/docs/cpp/cpp-ide#_code-formatting

Google C++ Style Guide
https://google.github.io/styleguide/cppguide.html

Linux kernel coding style
https://www.kernel.org/doc/html/v4.10/process/coding-style.html

Common libraries

SDL

SDL(Simple DirectMedia Layer) is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.

Tutorials

Released under the CC-BY-NC-4.0