Return to Fluent C Table of Contents, Fluent C, C Language Design Patterns, C Language, C Language Bibliography, C Language Courses, C Language DevOps - C Language CI/CD, C Language Security - C Language DevSecOps, C Language Functional Programming, C Language Concurrency, C Language Data Science - C Language and Databases, C Language Machine Learning, C Language Glossary, Awesome C Language, C Language GitHub, C Language Topics
overview of patterns for, xiv, 148, 163
application binary interface (ABI), 210
avoiding poorly implemented
Abstraction Layer pattern, 231-236, 256
Atomic Primitives pattern, 227-230, 257
association, versus aggregation, 133
Avoid Variants pattern, 220-224, 255,
Atomic Primitives pattern, 227-230, 257
266
further reading on, 243
error handling, 264
Isolated Primitives pattern, 224-227, 257
overview of patterns for, 218, 242
automatic variables, 62
Avoid Variants pattern, 220-223, 255, 266
Split Variant]] Implementations, 236-242,
258
A
C functions, returning data from (see also func‐
tions)
Aggregate Instance pattern, 103-107
Abstraction Layer pattern, 231-236, 256
Callee Allocates pattern, 116-119, 271
Aggregate Instance pattern, 103-107
Caller-Owned Buffer pattern, 111-114, 250
aggregation, versus association, 133
challenges of, 93
Allocation Wrapper pattern, 76-81
Immutable Instance pattern, 108-110
Out-Parameters pattern, 99-102
overview of patterns for, xiii, 94, 120
Return Value pattern, 95-97, 252, 264
Dynamic Interface pattern, 156-158, 253
Function Control pattern, 159-162
further reading on, 163
challenges of, viii-x
Callback Iterator pattern, 177-181
Header Files pattern, 149-151, 248, 263
Callee Allocates pattern, 116-119, 271
interface compatibility, 210
Caller-Owned Buffer pattern, 111-114, 250
277
Caller-Owned Instance pattern, 132-136, 270
problems with dynamic memory, 60
returning error information, 48
obtaining and using, xvii
references to examples presented in pat‐
Dedicated Ownership pattern, 72-75, 270
terns, xviii
dependency inversion principle, 148
design patterns (see also individual patterns)
approach to learning, xi
components, 202 (see also Self-Contained
benefits of, 259, 276
challenges of C programming language, vii
definition of term, x
Cursor Iterator pattern, 172-176, 269
development of, x
overview of
D
data lifetime and ownership, xiv
error handling, xii, 4
Caller-Owned Instance pattern, 132-136, escaping
270
further reading on, 145
overview of patterns for, xiv, 122, 144
memory management, xiii
organizing files in modular programs, xv
Shared Instance pattern, 138-143
returning data from C functions, xiii
Software-Module with Global State pattern,
returning error information, xii
127-131, 251, 262
purpose of, vii
Stateless Software-Module pattern, 123-127
references to examples presented in pat‐
structuring programs with object-like ele‐
terns, xviii
ments, 121
references to published papers, xxi
selecting, xi, 247, 261
Dedicated Ownership pattern, application
structure of, x
of, 75
directories, configuring, 194 (see also Software-
defining and documenting clean up, 72
dynamic memory, 69
Dynamic Interface pattern, 156-158, 253
maintaining data for longer periods, 65
dynamic memory, 59-61, 69, 85
problems with dynamic memory, 59-61, 85
108
reacting automatically to error situations, 76
challenges of, 3
selecting patterns for, 261
Function Split pattern, 6-8, 268
further reading on, 27
Goto Error Handling pattern, 16-19
Guard Clause pattern, 9-12, 268
debuging (see also error handling; error infor‐
Object-Based Error Handling pattern,
mation, returning)
22-24, 270
overview of patterns for, xii, 4, 26
detecting memory leaks, 70
eliminating memory errors, 63
Samurai Principle pattern, 12-16, 249, 265
logging debug information, 77
challenges of, 29
278 | Index
further reading on, 55
returning relevant errors only, 45
Log Errors pattern, 48-52, 266
returning status information, 33
overview of patterns for, xii, 30, 55
separating initialization and cleanup, 23
Return Relevant Errors pattern, 39-43, 252, sharing state information or resources, 152
264
splitting into separate, 95
Return Status Codes pattern, 32-35, 267
splitting responsibilities, 6
using standardized, 221
Special Return Values pattern, 45-47, 270
Global Include Directory pattern, 197-200, 248
files, organizing in modular programs
global variables, 95, 99, 103, 128
Goto Error Handling pattern, 16-19
challenges of, 185
Guard Clause pattern, 9-12, 268
Global Include Directory pattern, 197-200,
248
H
Include Guard pattern, 189-192, 249, 263
overview of patterns for, xv, 186, 216
header files (see also files, organizing in modu‐
lar programs)
Self-Contained Component pattern,
avoiding dependencies, 198
201-205
placing in subdirectories, 202
Software-Module Directories pattern,
placing only platform-independent func‐
192-195, 248, 264
tions in, 231
Stateless Software-Module pattern, 249
placing with implementation files, 193
fragmented memory, 60
protecting against multiple inclusion, 189
Header Files pattern, 149-151, 248, 263
Function Control pattern, 159-162
Function Split pattern, 6-8, 268
functions (see also C functions, returning data
from)
aborting programs in error conditions, 13
if statements, 20, 23
cleaning up multiple resources with, 16, 19, Immutable Instance pattern, 108-110
22
implementation details, hiding, 149
Include Guard pattern, 189-192, 249, 263
handling one kind of variant only, 228
Index Access pattern, 168-170, 252
definition of term, 121
sharing, 138
maintaining detailed error information, 48
interface compatibility, 210 (see also APIs, flex-passing meta-information about, 160
ible; Dynamic Interface pattern; iterator
placing only platform-independent in
header files, 231
interface segregation principle, 148
providing access to multiple threads, 132
Isolated Primitives pattern, 224-226, 257
retrieving one element at a time, 173
returning multiple pieces of information,
Callback Iterator pattern, 177-181
99, 103
Cursor Iterator pattern, 172-176, 269
Index | 279
further reading on, 183
organizing files in
Index Access pattern, 168-170, 252
overview of patterns for, xv, 166, 182
modular programs, ease of maintaining, 149
(see also files, organizing in modular pro‐
grams)
multiline macros, 50
Lazy Acquisition pattern, 255
multithreaded environments, 101, 132, 177
lazy evaluation, 20
Linux overcommit, 84
Object-Based Error Handling pattern, 22-24,
Liskow substitution principle, 147
270
Log Errors pattern, 48-52, 266
organizing files (see files, organizing in modu‐
conditional logging, 252
lar programs)
context, 247
Out-Parameters pattern, 99-102
overcommit principle, 84
file organization, 248
packages, 185
multiple logging destinations, 253
passwords, 262
overview of patterns used, 259
patterns (see design patterns)
using the logger, 259
macros, multiline, 50
Makefiles, 194
memory fragmentation, 85
acquiring and cleaning up multiple, 16, 19, memory leaks
22
deliberately creating, 70
lifetime and ownership of, 121
detecting, 70
sharing, 152
eliminating risk of, 63
Return Relevant Errors pattern, 39-43, 252, 264
garbage collection and, 71
Return Status Codes pattern, 32-35, 267
Return Value pattern, 95-97, 252, 264
Allocation Wrapper pattern, 76-81
return values, special, 45
challenges of, 57
returning data from C functions (see C func‐
data storage and dynamic memory, 59-61
Dedicated Ownership pattern, 72-75, 270
returning error information (see error informa‐
Eternal Memory pattern, 65-68, 251, 255,
tion, returning)
262
further reading on, 90
Memory Pool pattern, 84-88
overview of patterns for, xiii, 58, 90
Samurai Principle pattern, 12-16, 249, 265
Self-Contained Component pattern, 201-205
Stack First pattern, 62-64, 267
Shared Instance pattern, 138-143
Memory Pool pattern, 84-88
single-responsibility principle, 147
280 | Index
smart pointers, 60
user management system example
Software-Module Directories pattern, 192-195,
248, 264
Software-Module with Global State pattern,
error handling, 264
127-131, 251, 262
context, 261
data organization, 261
Special Return Values pattern, 45-47, 270
file organization, 263
Split Variant]] Implementations pattern, 236-242,
iterating, 269
258
overview of patterns used, 272
splitting function responsibilities (see Function
using the system, 272
state information, sharing, 152
Stateless Software-Module pattern, 123-127,
valgrind, 70, 78
249
status codes, returning (see Return Status
version numbers, 211
synchronization issues, 101
Index | 281
C Language: C Fundamentals, C Inventor - C Language Designer: Dennis Ritchie in 1972; C Standards: ANSI X3J11 (ANSI C); ISO/IEC JTC 1 (Joint Technical Committee 1) / SC 22 (Subcommittee 22) / WG 14 (Working Group 14) (ISO C); C Keywords, C Pointers, C Data Structures - C Algorithms, C Syntax, C Memory Management, C Recursion, C on Android, C on Linux, C on macOS, C on Windows, C Installation, C Containerization, C Configuration, C Compiler, C IDEs (CLion), C Development Tools, C DevOps - C SRE, C Data Science - C DataOps, C Machine Learning, C Deep Learning, C Concurrency, C History, C Bibliography, Manning C Programming Series, C Glossary, C Topics, C Courses, C Standard Library, C Libraries, C Frameworks, C Research, C GitHub, Written in C, C Popularity, C Awesome List, C Versions. (navbar_c)
Design Patterns: Design Patterns - Elements of Reusable Object-Oriented Software by GoF, Awesome Design Patterns, Awesome Software Design, Pattern, Design, Anti-Patterns, Code Smells, Best Practices, Software Architecture, Software Design, Design Principles, Design Patterns Bibliography, C Language Design Patterns, C++ Design Patterns, C# Design Patterns, Golang Design Patterns, Java Design Patterns, JavaScript Design Patterns, Kotlin Design Patterns, Node.js Design Patterns, Python Design Patterns, TypeScript Design Patterns, Scala Design Patterns, Swift Design Patterns. (navbar_designpatterns)
© 1994 - 2024 Cloud Monk Losang Jinpa or Fair Use. Disclaimers
SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.