User Tools

Site Tools


c11

Overview

Fedora packages

  • clang
  • valgrind
  • meld [for graphical diff]
  • strace; ltrace
  • splint
  • pkg-config
  • gdb; lldb

To document

  • List the properties of “embedded C”.

DON'T CARE

  • digraphs/trigraphs
  • “return”ing from main, no need as it's default return zero

NOTES

  • simple language, most work done by library routines (standard + math)
  • “translation unit”
  • predefined identifier __func__
  • scopes:
    • file
    • block
    • function prototype
    • function

TOPICS

Types

  • scalar
    • arithmetic
      • basic
      • enums
    • pointers
  • aggregate
    • array
    • structure

Assertions

Compound literals

Generic selections

Preprocessor

  • #define

Threading

Exit/abort

setjmp/longjmp

Atomic objects

GNU extensions

  • include_next

Static analyzers

Libraries

  • because C is a very simple language

TO DO

  • ptrdiff_t, size_t
  • inline functions
  • flexible array/structure member
  • multi-threading
  • type-generic macros
  • variadic macros
  • assert(), static_assert(), _Static_assert()
  • new library functions(?)
  • include_next
  • compound literals
  • variadic functions (p. 127)
  • “restrict” type qualifier
  • offsetof()
  • generic selections (_Generic)
  • Define “embedded C”.
  • syntactic analysers
  • setjmp/longjmp
  • exit/quick_exit/_Exit/at_exit/at_quick_exit

C11 features

Reserved C keywords

auto      extern    short     while
break     float     signed    _Alignas
case      for       sizeof    _Alignof
char      goto      static    _Atomic
const     if        struct    _Bool
continue  inline    switch    _Complex
default   int       typedef   _Generic
do        long      union     _Imaginary
double    register  unsigned  _Noreturn
else      restrict  void      _Static_assert
enum      return    volatile  _Thread_local

This and that

  • name spaces
    • labels
    • tags (struct, union, enum)
    • struct or union members
    • all others
  • scopes
    • file
    • block
    • function prototype
    • function
  • GNU glibc contains:
    • standard library
    • math library
  • multi-threading
    • thread local
    • quick_exit()
  • anonymous structs/unions
  • type-generic functions
  • memory alignment control
  • _Noreturn function specifier
  • Unicode support
  • static assertions
  • bounds-checking functions

Types

  • long long
  • _Bool (reserved keyword)

This and that

  • declaration versus definition
  • no nested functions but can declare a function inside another one
  • wide versus multibyte characters
  • digraphs and trigraphs
  • scope:
    • file
    • block
    • prototype
    • function (includes labels)
  • alignment
    • _Alignof
    • _Alignas
  • __func__
  • generic selections
  • compound literals

Arrays

  • element designators

Threads

  • C11 threads versus POSIX threads (threads.h)
c11.txt · Last modified: 2019/08/05 13:31 by rpjday