Effective C: An Introduction to Professional C Programming

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

A detailed introduction to the C programming language for experienced programmers. 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.

Author(s): Robert C. Seacord
Edition: 1
Publisher: No Starch Press
Year: 2020

Language: English
Commentary: Vector PDF
Pages: 272
City: San Francisco, CA
Tags: Programming; Debugging; Memory Management; Static Analysis; C; Unit Testing; Testing; Elementary

Brief Contents
Contents in Detail
Foreword by Pascal Cuoq
Foreword by Ollie Whitehouse
Acknowledgments
Introduction
A Brief History of C
The C Standard
The CERT C Coding Standard
Who This Book Is For
What’s in This Book
Chapter 1: Getting Started with C
Developing Your First C Program
Compiling and Running Your Program
Preprocessor Directives
The main Function
Checking Function Return Values
Formatted Output
Editors and Integrated Development Environments
Compilers
GNU Compiler Collection
Clang
Microsoft Visual Studio
Portability
Implementation-Defined Behavior
Unspecified Behavior
Undefined Behavior
Locale-Specific Behavior and Common Extensions
Summary
Chapter 2: Objects, Functions, and Types
Objects, Functions, Types, and Pointers
Declaring Variables
Swapping Values (First Attempt)
Swapping Values (Second Attempt)
Scope
Storage Duration
Alignment
Object Types
Boolean Types
Character Types
Numerical Types
void Types
Function Types
Derived Types
Pointer Types
Arrays
Structures
Unions
Tags
Type Qualifiers
const
volatile
restrict
Exercises
Summary
Chapter 3: Arithmetic Types
Integers
Padding and Precision
The Header File
Declaring Integers
Unsigned Integers
Signed Integers
Integer Constants
Floating-Point
Floating-Point Types
Floating-Point Arithmetic
Floating-Point Values
Floating-Point Constants
Arithmetic Conversion
Integer Conversion Rank
Integer Promotions
Usual Arithmetic Conversions
An Example of Implicit Conversion
Safe Conversions
Summary
Chapter 4: Expressions and Operators
Simple Assignment
Evaluations
Function Invocation
Increment and Decrement Operators
Operator Precedence and Associativity
Order of Evaluation
Unsequenced and Indeterminately Sequenced Evaluations
Sequence Points
sizeof Operator
Arithmetic Operators
Unary + and – Operators
Logical Negation Operator
Multiplicative Operators
Additive Operators
Bitwise Operators
Complement Operator
Shift Operators
Bitwise AND Operator
Bitwise Exclusive OR Operator
Bitwise Inclusive OR Operator
Logical Operators
Cast Operators
Conditional Operator
_Alignof Operator
Relational Operators
Compound Assignment Operators
Comma Operator
Pointer Arithmetic
Summary
Chapter 5: Control Flow
Expression Statements
Compound Statements
Selection Statements
The if Statement
The switch Statement
Iteration Statements
The while Statement
The do...while Statement
The for Statement
Jump Statements
The goto Statement
The continue Statement
The break Statement
The return Statement
Exercises
Summary
Chapter 6: Dynamically Allocated Memory
Storage Duration
The Heap and Memory Managers
When to Use Dynamically Allocated Memory
Memory Management Functions
The malloc Function
The aligned_alloc Function
The calloc Function
The realloc Function
The reallocarray Function
The free Function
Memory States
Flexible Array Members
Other Dynamically Allocated Storage
The alloca Function
Variable-Length Arrays
Debugging Allocated Storage Problems
Dmalloc
Safety-Critical Systems
Exercises
Summary
Chapter 7: Characters and Strings
Characters
ASCII
Unicode
Source and Execution Character Sets
Data Types
Character Constants
Escape Sequences
Linux
Windows
Character Conversion
Strings
String Literals
String-Handling Functions
and
Annex K Bounds-Checking Interfaces
POSIX
Microsoft
Summary
Chapter 8: Input/Output
Standard I/O Streams
Stream Buffering
Predefined Streams
Stream Orientation
Text and Binary Streams
Opening and Creating Files
The fopen Function
The POSIX open Function
Closing Files
The fclose Function
The POSIX close Function
Reading and Writing Characters and Lines
Stream Flushing
Setting the Position in a File
Removing and Renaming Files
Using Temporary Files
Reading Formatted Text Streams
Reading to and Writing from Binary Streams
Summary
Chapter 9: Preprocessor
The Compilation Process
File Inclusion
Quoted and Angle Bracket Include Strings
Conditional Inclusion
Generating Errors
Using Header Guards
Macro Definitions
Macro Replacement
Type-Generic Macros
Predefined Macros
Summary
Chapter 10: Program Structure
Principles of Componentization
Coupling and Cohesion
Code Reuse
Data Abstractions
Opaque Types
Executables
Linkage
Structuring a Simple Program
Building the Code
Summary
Chapter 11: Debugging, Testing, and Analysis
Assertions
Static Assertions
Runtime Assertions
Compiler Settings and Flags
GCC and Clang
Visual C++
Debugging
Unit Testing
Static Analysis
Dynamic Analysis
AddressSanitizer
Exercises
Summary
References
Index