Acknowledgments |
|
ix | |
About this book |
|
xi | |
About the cover illustration |
|
xvi | |
|
|
1 | (20) |
|
|
3 | (8) |
|
1.1 Imperative programming |
|
|
4 | (1) |
|
1.2 Compiling and running |
|
|
5 | (6) |
|
2 The principal structure of a program |
|
|
11 | (10) |
|
|
11 | (2) |
|
|
13 | (2) |
|
|
15 | (2) |
|
|
17 | (4) |
|
|
17 | (1) |
|
|
18 | (1) |
|
|
19 | (2) |
|
|
21 | (126) |
|
3 Everything is about control |
|
|
27 | (10) |
|
3.1 Conditional execution |
|
|
28 | (2) |
|
|
30 | (4) |
|
|
34 | (3) |
|
4 Expressing computations |
|
|
37 | (12) |
|
|
40 | (2) |
|
|
40 | (1) |
|
|
41 | (1) |
|
4.2 Operators that modify objects |
|
|
42 | (1) |
|
|
43 | (2) |
|
|
43 | (1) |
|
|
44 | (1) |
|
4.4 The ternary or conditional operator |
|
|
45 | (1) |
|
|
45 | (4) |
|
|
49 | (32) |
|
5.1 The abstract state machine |
|
|
50 | (4) |
|
|
52 | (1) |
|
|
52 | (1) |
|
Binary representation and the abstract state machine |
|
|
52 | (1) |
|
|
53 | (1) |
|
|
54 | (3) |
|
|
57 | (4) |
|
|
61 | (1) |
|
|
61 | (3) |
|
|
64 | (1) |
|
|
65 | (5) |
|
|
66 | (1) |
|
|
67 | (1) |
|
|
68 | (1) |
|
|
69 | (1) |
|
|
70 | (11) |
|
|
70 | (1) |
|
Bit sets and bitwise operators |
|
|
71 | (2) |
|
|
73 | (1) |
|
|
74 | (1) |
|
|
74 | (3) |
|
Fixed-width integer types |
|
|
77 | (1) |
|
|
78 | (3) |
|
|
81 | (18) |
|
|
82 | (7) |
|
|
82 | (1) |
|
|
83 | (1) |
|
|
83 | (2) |
|
|
85 | (1) |
|
|
85 | (4) |
|
6.2 Pointers as opaque types |
|
|
89 | (2) |
|
|
91 | (5) |
|
6.4 New names for types: type aliases |
|
|
96 | (3) |
|
|
99 | (14) |
|
|
100 | (2) |
|
|
102 | (2) |
|
|
104 | (9) |
|
|
113 | (34) |
|
8.1 General properties of the C library and its functions |
|
|
113 | (6) |
|
|
114 | (1) |
|
|
114 | (2) |
|
|
116 | (1) |
|
Bounds-checking interfaces |
|
|
117 | (1) |
|
|
118 | (1) |
|
|
119 | (2) |
|
8.3 Input, output, and file manipulation |
|
|
121 | (11) |
|
|
121 | (2) |
|
|
123 | (2) |
|
|
125 | (2) |
|
|
127 | (3) |
|
|
130 | (2) |
|
8.4 String processing and conversion |
|
|
132 | (4) |
|
|
136 | (5) |
|
8.6 Runtime environment settings |
|
|
141 | (2) |
|
8.7 Program termination and assertions |
|
|
143 | (4) |
|
|
147 | (108) |
|
|
149 | (8) |
|
|
150 | (1) |
|
|
151 | (6) |
|
10 Organization and documentation |
|
|
157 | (12) |
|
10.1 Interface documentation |
|
|
158 | (3) |
|
|
161 | (8) |
|
|
162 | (2) |
|
|
164 | (5) |
|
|
169 | (22) |
|
|
170 | (8) |
|
Address-of and object-of operators |
|
|
170 | (1) |
|
|
171 | (2) |
|
Pointer subtraction and difference |
|
|
173 | (2) |
|
|
175 | (2) |
|
|
177 | (1) |
|
11.2 Pointers and structures |
|
|
178 | (4) |
|
|
182 | (2) |
|
Array and pointer access are the same |
|
|
182 | (1) |
|
Array and pointer parameters are the same |
|
|
182 | (2) |
|
|
184 | (7) |
|
|
191 | (14) |
|
12.1 A uniform memory model |
|
|
193 | (1) |
|
|
193 | (2) |
|
|
195 | (2) |
|
12.4 Pointers to unspecific objects |
|
|
197 | (1) |
|
12.5 Explicit conversions |
|
|
198 | (1) |
|
|
199 | (1) |
|
|
200 | (5) |
|
|
205 | (26) |
|
|
206 | (9) |
|
A complete example with varying array size |
|
|
207 | (8) |
|
Ensuring consistency of dynamic allocations |
|
|
215 | (1) |
|
13.2 Storage duration, lifetime, and visibility |
|
|
215 | (6) |
|
|
219 | (1) |
|
Automatic storage duration |
|
|
220 | (1) |
|
13.3 Digression: using objects "before" their definition |
|
|
221 | (2) |
|
|
223 | (2) |
|
13.5 Digression: a machine model |
|
|
225 | (6) |
|
14 More involved processing and IO |
|
|
231 | (24) |
|
|
231 | (7) |
|
|
238 | (1) |
|
14.3 Extended character sets |
|
|
239 | (8) |
|
|
247 | (2) |
|
14.5 Error checking and cleanup |
|
|
249 | (6) |
|
|
255 | (102) |
|
|
257 | (44) |
|
|
260 | (3) |
|
15.2 Using restrict qualifiers |
|
|
263 | (2) |
|
15.3 Measurement and inspection |
|
|
265 | (12) |
|
|
275 | (2) |
|
16.1 How function-like macros work |
|
|
277 | (2) |
|
|
279 | (3) |
|
16.3 Accessing the calling context |
|
|
282 | (3) |
|
|
285 | (1) |
|
16.5 Variable-length argument lists |
|
|
286 | (8) |
|
|
287 | (4) |
|
A detour: variadic functions |
|
|
291 | (3) |
|
16.6 Type-generic programming |
|
|
294 | (7) |
|
17 Variations in control flow |
|
|
301 | (24) |
|
17.1 A complicated example |
|
|
303 | (2) |
|
|
305 | (3) |
|
|
308 | (1) |
|
|
309 | (1) |
|
|
310 | (5) |
|
|
315 | (10) |
|
|
325 | (20) |
|
18.1 Simple inter-thread control |
|
|
328 | (2) |
|
18.2 Race-free initialization and destruction |
|
|
330 | (3) |
|
|
333 | (1) |
|
18.4 Critical data and critical sections |
|
|
333 | (3) |
|
18.5 Communicating through condition variables |
|
|
336 | (5) |
|
18.6 More sophisticated thread management |
|
|
341 | (4) |
|
19 Atomic access and memory consistency |
|
|
345 | (12) |
|
19.1 The "happened before" relation |
|
|
347 | (2) |
|
19.2 C library calls that provide synchronization |
|
|
349 | (3) |
|
19.3 Sequential consistency |
|
|
352 | (1) |
|
19.4 Other consistency models |
|
|
353 | (4) |
Takeaways |
|
357 | (13) |
Bibliography |
|
370 | (2) |
Index |
|
372 | |