Effective C

Book description

The world runs on code written in the C programming language, yet most schools begin the curriculum with Python or Java. Effective C bridges this gap and brings C into the modern era—covering the modern C17 Standard as well as potential C2x features. With the aid of this instant classic, you’ll soon be writing professional, portable, and secure C programs to power robust systems and solve real-world problems.

Robert C. Seacord introduces C and the C Standard Library while addressing best practices, common errors, and open debates in the C community. Developed together with other C Standards committee experts, Effective C will teach you how to debug, test, and analyze C programs. You’ll benefit from Seacord’s concise explanations of C language constructs and behaviors, and from his 40 years of coding experience.

You’ll learn:

•How to identify and handle undefined behavior in a C program
•The range and representations of integers and floating-point values
•How dynamic memory allocation works and how to use nonstandard functions
•How to use character encodings and types
•How to perform I/O with terminals and filesystems using C Standard streams and POSIX file descriptors
•How to understand the C compiler’s translation phases and the role of the preprocessor
•How to test, debug, and analyze C programs

Effective C will teach you how to write professional, secure, and portable C code that will stand the test of time and help strengthen the foundation of the computing world.

Table of contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. Dedication
  5. About the Author
  6. About the Contributor
  7. About the Tech Reviewer
  8. BRIEF CONTENTS
  9. CONTENTS IN DETAIL
  10. FOREWORD BY PASCAL CUOQ
  11. FOREWORD BY OLLIE WHITEHOUSE
  12. ACKNOWLEDGMENTS
  13. INTRODUCTION
    1. A Brief History of C
    2. The C Standard
    3. The CERT C Coding Standard
    4. Who This Book Is For
    5. What’s in This Book
  14. 1 GETTING STARTED WITH C
    1. Developing Your First C Program
    2. Editors and Integrated Development Environments
    3. Compilers
    4. Portability
    5. Summary
  15. 2 OBJECTS, FUNCTIONS, AND TYPES
    1. Objects, Functions, Types, and Pointers
    2. Declaring Variables
    3. Scope
    4. Storage Duration
    5. Alignment
    6. Object Types
    7. Function Types
    8. Derived Types
    9. Tags
    10. Type Qualifiers
    11. Exercises
    12. Summary
  16. 3 ARITHMETIC TYPES
    1. Integers
    2. Floating-Point
    3. Arithmetic Conversion
    4. Summary
  17. 4 EXPRESSIONS AND OPERATORS
    1. Simple Assignment
    2. Evaluations
    3. Function Invocation
    4. Increment and Decrement Operators
    5. Operator Precedence and Associativity
    6. Order of Evaluation
    7. sizeof Operator
    8. Arithmetic Operators
    9. Bitwise Operators
    10. Logical Operators
    11. Cast Operators
    12. Conditional Operator
    13. _Alignof Operator
    14. Relational Operators
    15. Compound Assignment Operators
    16. Comma Operator
    17. Pointer Arithmetic
    18. Summary
  18. 5 CONTROL FLOW
    1. Expression Statements
    2. Compound Statements
    3. Selection Statements
    4. Iteration Statements
    5. Jump Statements
    6. Exercises
    7. Summary
  19. 6 DYNAMICALLY ALLOCATED MEMORY
    1. Storage Duration
    2. Memory Management Functions
    3. Memory States
    4. Flexible Array Members
    5. Other Dynamically Allocated Storage
    6. Debugging Allocated Storage Problems
    7. Exercises
    8. Summary
  20. 7 CHARACTERS AND STRINGS
    1. Characters
    2. Strings
    3. String-Handling Functions
    4. Summary
  21. 8 INPUT/OUTPUT
    1. Standard I/O Streams
    2. Opening and Creating Files
    3. Closing Files
    4. Reading and Writing Characters and Lines
    5. Stream Flushing
    6. Setting the Position in a File
    7. Removing and Renaming Files
    8. Using Temporary Files
    9. Reading Formatted Text Streams
    10. Reading from and Writing to Binary Streams
    11. Summary
  22. 9 PREPROCESSOR
    1. The Compilation Process
    2. File Inclusion
    3. Conditional Inclusion
    4. Macro Definitions
    5. Summary
  23. 10 PROGRAM STRUCTURE
    1. Principles of Componentization
    2. Executables
    3. Linkage
    4. Structuring a Simple Program
    5. Building the Code
    6. Summary
  24. 11 DEBUGGING, TESTING, AND ANALYSIS
    1. Assertions
    2. Compiler Settings and Flags
    3. Debugging
    4. Unit Testing
    5. Static Analysis
    6. Dynamic Analysis
    7. Exercises
    8. Summary
  25. REFERENCES
  26. INDEX

Product information

  • Title: Effective C
  • Author(s): Robert C. Seacord
  • Release date: August 2020
  • Publisher(s): No Starch Press
  • ISBN: 9781718501041