Programming with C · Index
Index
Fifty-six weeks is a lot to hold in your head. This page is for the moment you remember that something was explained but not where. The bold number is the week that explains it; the rest are the weeks that use it.
1Functions, types, keywords and flags
# A B C D E F G I L M N O P Q R S T U V W Z
#
- ++i
- 6
- .bss
- 17 49 52 53
- .c
- 1 28 29
- .data
- 52 17 22 49 51
- .rodata
- 14 17 52
- .text
- 17 29 49 52
- 0x20000000
- 49 50 52
- \n
- 1 3 5 8 26 40
A
B
C
D
E
- EAGAIN
- 47 40
- else
- 9 35
- elseif
- 9
- endptr
- 16 23 27 44
- enum
- 5 9 22 28
- EOF
- 8 14 27
- epoll
- 47 40 46
- errno
- 27 16 23 24 26 40 41 44 46 47
- exec
- 39
- _Exit
- 31
- exit
- 31 3 39
- EXIT_FAILURE
- 3
- EXIT_SUCCESS
- 3
F
- %f
- 3 4 8
- false
- 2 3 5 16 56
- fgets
- 3 8 23 26 27 56
- fopen
- 11 13 26 27 44 49
- for
- 10 2 6
- fork
- 39 47
- fread
- 26 27 44
- free
- 19 3 17 20 27 32 36 39 43 44 46 47 48
- -fsanitize=address
- 13 14 17 20 36 39 48
- -fsanitize=undefined
- 25 30 36 48
G
- -g
- 1 2 35
- _Generic
- 30 2 29
- getaddrinfo
- 40
- getopt
- 31 23
- gets
- 8 44 56
- goto
- 10 9 17 20 26 27 42
- gprof
- 34
- grep
- 31 39 43
I
L
M
- main
- 3 1 2 11 17 31 35 42 49 52
- malloc
- 19 3 5 11 13 16 17 20 22 27 35 36 38 39 42 44 47 48 49 51 52 53 56
- maximum
- 10 11 43
- memcmp
- 12 21 22
- memcpy
- 14 3 12 21 30 36 37 38
- memmove
- 14 36 38 40
N
- NaN
- 7 24
- nm
- 29 2 17
- NOLOAD
- 52 53 55
- _Noreturn
- 38 2
- NULL
- 11 13 14 15 16 17 18 19 20 23 26 27 30 31 32 36 38 42 44 48 53
O
P
- perf
- 34
- perror
- 27 26 40
- pkg-config
- 45 44
- poll
- 47
- printf
- 3 1 2 4 7 8 13 20 22 24 26 27 30 35 36 39 49 51 52 53 55
- ptrdiff_t
- 15
Q
R
S
- %s
- 8 3 26 36 44
- -S
- 2 6 15 49 56
- scanf
- 8 3 7 11 12 13 23 32
- select
- 47
- setjmp
- 38
- size_t
- 5 3 7 8 12 14 15 19 37 45 48
- sizeof
- 5 4 6 12 13 14 16 21 22 37 42
- snprintf
- 14 2 24 36 44 48 56
- soname
- 45 44
- sqrt
- 1 3 24
- sscanf
- 8 26 44
- static
- 11 17 28 29 38 42 45 56
- static_assert
- 27 50
- -std=
- 2
- stderr
- 8 23 26 27 31 39
- stdin
- 8 23 39
- stdout
- 8 23 26 31 39
- strcmp
- 14 9 44
- strcpy
- 14 3 16 44 48 56
- strerror
- 27 41
- strlen
- 3 5 7 12 14 37 42
- strncpy
- 14
- strtok
- 14 17 41 44
- strtok_r
- 14 41 44
- strtol
- 23 3 8 16 27 43 44 48 56
- swap
- 13 11 12
- switch
- 9 10 22 27 30
T
U
V
W
Z
2Topics
# A B C D E F G H I K L M N O P R S T U V W Y
#
- % works on integers only
- 6
A
- A fixed-block pool
- 53
- A hardware abstraction layer
- 55
- A tolerance that scales
- 7
- A usable Makefile
- 29
- About those flags
- 1
- Access: . and ->
- 21
- Alignment
- 37
- An error contract for a module
- 27
- API versus ABI
- 45
- argc and argv
- 23
- Arithmetic operators
- 6
- Arithmetic scales by the element
- 15
- Array decay
- 13
- Arrays of structures
- 21
- Assertions
- 27
- Assignment binds looser than almost everything
- 6
- Assignment, compound assignment, increment
- 6
- Atomicity: volatile does not provide it
- 51
- Atomics and the memory model
- 41
B
- Behaving well in a pipeline
- 23
- Binary records and positioning
- 26
- Binary search trees
- 33
- Bit-fields
- 25
- Bits, bytes, and words
- 4
- Bitwise operators bind looser than comparison
- 6
- Block memory operations
- 14
- break, continue, and goto
- 10
- Buffering
- 26
- Building strings safely
- 14
- By value or by pointer?
- 21
- Byte order
- 37
C
- Callbacks and qsort
- 30
- Character-at-a-time input and output
- 8
- Characterization tests
- 56
- Characters
- 4
- Checking every allocation
- 19
- Checking return values
- 27
- Code size
- 53
- Comparing floating-point values
- 7
- Compilers, interpreters, and assemblers
- 1
- Complexity, honestly
- 33
- Compound literals and anonymous members
- 38
- Computing the length
- 12
- Condition variables
- 41
- Conditional compilation
- 28
- Confirming it works
- 1
- const and what it qualifies
- 16
- const correctness as a discipline
- 16
- const — a typed, read-only object
- 5
- Conversions happen whether you ask or not
- 7
- Cross-compilation
- 49
- <ctype.h> and safe construction
- 14
D
- Data layout
- 34
- Data races
- 41
- Declaration, definition, call
- 11
- Declarations and initialization
- 5
- Declaring a pointer
- 13
- Declaring a structure
- 21
- Declaring a variable inside a switch
- 9
- Declaring and initializing
- 12
- Declaring the counter inside
- 10
- Defences that work
- 36
- #define — textual substitution
- 5
- Depth and stack overflow
- 18
- Designing a function
- 11
- Designing for foreign callers
- 46
- Detecting an over-long line
- 23
- Dispatch tables
- 30
- do-while — test after
- 10
- Doubly linked and circular
- 32
E
- Each class in detail
- 20
- enum — named integer constants
- 5
- Enumerations
- 22
- errno
- 27
- Errors and concurrency
- 44
- Escaping a nested loop
- 10
- Evaluation order: the part that is not defined
- 6
- exec and waiting
- 39
- Explicit conversion: the cast
- 7
- Exporting only what you mean to
- 45
F
- Failure mode 1 — the leftover newline
- 8
- Failure mode 2 — the infinite loop
- 8
- Failure mode 3 — %s and buffer overflow
- 8
- File descriptors
- 39
- Fixed-point arithmetic
- 53
- Fixed-width types
- 37
- Floating point: IEEE 754
- 4
- for — the counted loop
- 10
- fork
- 39
- Freestanding versus hosted
- 49
- From a book to a standard
- 2
- From reset to main
- 49
- From undefined behavior to vulnerability
- 36
- Function pointers
- 30
- Fuzzing finds nothing without sanitizers
- 48
G
H
- Half-open ranges and off-by-one errors
- 10
- Harvard versus von Neumann
- 49
- Hash tables
- 33
- Headers and include guards
- 28
- How a computer executes a program
- 1
- How an optimizer exploits it
- 36
- How to read a codebase
- 42
- How to write a review comment
- 44
I
- Idioms worth borrowing, and not
- 42
- if, else if, else
- 9
- #include and where names come from
- 3
- Increment and decrement
- 6
- Index or pointer?
- 15
- Indexing, and why size_t
- 12
- Information hiding and opaque pointers
- 28
- inline
- 38
- Insertion and lookup
- 33
- Insertion and removal
- 32
- Installing a toolchain
- 1
- Integer division truncates
- 6
- Integer promotion
- 7
- Integers and undefined behavior
- 44
- It returns a count, and you must check it
- 8
K
- Knowing your machine: <limits.h> and <float.h>
- 5
L
- Layered configuration
- 31
- Let a tool do it
- 3
- Level-triggered and edge-triggered
- 47
- Line by line
- 1
- Linkage and the one-definition rule
- 28
- Linker symbols in C
- 52
- Linking order and symbol resolution
- 29
- Literals and escape sequences
- 5
- Literals are read-only
- 14
- Load address and virtual address
- 52
- Load factor and resizing
- 33
- Loop invariants
- 10
M
- main and its return value
- 3
- <math.h>
- 24
- Measuring elapsed time
- 24
- Merge or rebase
- 44
- Migrating standards and compilers
- 56
N
- Name mangling and extern "C"
- 46
- NaN and infinity
- 7
- Negating a number
- 4
- Nested loops
- 10
- Nesting and arrays
- 21
- Non-blocking descriptors
- 47
- _Noreturn, setjmp, and longjmp
- 38
O
- On-chip debugging
- 55
- Opening and closing
- 26
- Optimization levels
- 34
- Out of range: what actually happens
- 12
- Output parameters and the status return
- 16
- Ownership across the boundary
- 46
P
- Packing values into one integer
- 25
- Padding, alignment, and offsetof
- 22
- Partial transfers and errors
- 40
- Pass by value — the rule with no exceptions
- 11
- Passing a 2D array to a function
- 12
- Passing strings and multidimensional arrays
- 16
- Phase 1 — the preprocessor
- 2
- Phase 2 — the compiler proper
- 2
- Phase 3 — the assembler
- 2
- Phase 4 — the linker
- 2
- Pipes and redirection
- 39
- Pointers as parameters — the fix for swap
- 13
- Pointers to pointers, and arrays of pointers
- 15
- Polling or interrupts?
- 51
- Positional number systems
- 4
- Precedence and associativity
- 6
- printf in detail
- 8
- Printing with printf
- 3
- Priorities, nesting, and latency
- 51
- Priority inversion
- 54
- Profiling
- 34
- Pseudo-random numbers
- 24
R
- Reading a reference manual
- 50
- Reading a report
- 20
- Reading before writing
- 43
- Reading declarations: the right-left rule
- 16
- Reading old C
- 56
- Reading standard input
- 23
- Reading text
- 26
- Reading the documentation
- 24
- Reading the generated assembly
- 34
- Reconstructing the conventions
- 42
- Reducing a failure
- 35
- Reentrancy
- 41
- Refactoring safely
- 56
- Relational and logical operators
- 6
- Removal, and the special case
- 32
- restrict
- 38
- Returning a pointer
- 16
- Reviewing C
- 44
- Rules that make output parameters pleasant
- 16
S
- scanf and its three failure modes
- 8
- Scope: where a name is visible
- 17
- Self-referential structures
- 21
- Semaphores and mutexes
- 54
- Shared libraries
- 29
- Sharing data with an ISR
- 51
- Short-circuit evaluation is guaranteed
- 6
- Signed integers and two's complement
- 4
- sizeof and size_t
- 5
- soname and symbol visibility
- 45
- Stack placement and overflow
- 52
- Stacks and queues
- 32
- Statements, blocks, and punctuation
- 3
- Static allocation and pools
- 53
- static at file scope means something else
- 17
- static for helpers
- 11
- Static libraries
- 29
- static_assert
- 27
- Storage duration: how long an object lives
- 17
- strcmp returns 0 for equal
- 14
- Strict aliasing
- 36
- Stringify and paste
- 28
- strncpy is not the safe strcpy
- 14
- strtok modifies its input
- 14
- Structure of arrays
- 34
- Structuring the loop
- 47
- Style: writing for the next reader
- 3
- Submitting a change
- 44
- Subtraction and ptrdiff_t
- 15
- Surviving failure
- 53
- switch
- 9
- switch or if?
- 9
T
- Technical debt
- 56
- Testing several bits
- 25
- Text beyond ASCII
- 37
- Text to number, done properly
- 23
- The <string.h> functions
- 14
- The abstract data type
- 33
- The basic types
- 5
- The calling convention
- 46
- The common sources
- 36
- The complete strtol pattern
- 23
- The conditional operator
- 9
- The cost of global state
- 17
- The dangling else
- 9
- The Fibonacci trap
- 18
- The five classes
- 20
- The format-string bug
- 36
- The four translation phases
- 2
- The goto cleanup idiom
- 27
- The hash function
- 33
- The input buffer
- 8
- The integer-overflow allocation bug
- 36
- The lock-free alternative
- 51
- The machine
- 49
- The memory hierarchy
- 34
- The memory map of a running program
- 17
- The minimal change
- 43
- The naive fix, and why it is not enough
- 7
- The obvious idea, and why it fails
- 4
- The order to apply tools
- 35
- The preprocessor is a text tool
- 28
- The public header
- 45
- The reason to use them
- 22
- The ring buffer
- 53
- The rules you may not break
- 15
- The seed corpus
- 48
- The server sequence
- 40
- The shape of a C program
- 3
- The shift traps
- 25
- The signed-unsigned trap
- 7
- The special values
- 4
- The stray semicolon
- 9
- The superloop and its limit
- 54
- The swap that cannot work
- 11
- The tagged union
- 22
- The three multiplexers
- 47
- The three ways a pointer goes wrong
- 13
- The tools
- 20
- The two lines that matter most
- 29
- The uninitialized variable
- 5
- The usual arithmetic conversions
- 7
- There is no elseif keyword
- 9
- _Thread_local
- 41
- Threat modeling
- 48
- <time.h>
- 24
- Timers and signals
- 47
- Triage and minimization
- 48
- Two-dimensional arrays
- 12
- typedef
- 22
U
V
- Variable-length arrays
- 38
- Variadic functions
- 30
- Versions and changelogs
- 44
- void *
- 13
- void in both positions
- 11
- volatile
- 38
- volatile: necessary, not sufficient
- 51
W
- When a cast is right
- 7
- When a cast is wrong
- 7
- When a list actually wins
- 32
- When a static local is right
- 17
- When recursion is the right shape
- 18
- When the value does not fit
- 7
- When to use which
- 37
- Where C came from
- 2
- Where it clearly helps
- 22
- Where it hurts
- 22
- Where the sequence points are
- 6
- Where to read
- 42
- while — test first
- 10
- Width, precision, and flags
- 8
- Writing
- 26
- Writing a target
- 48
Y
- Your first program
- 1