The C Companion

Allen I. Holub

Publisher: Prentice Hall, 1987, 284 pages

ISBN: 0-13-109786-5

Keywords: Programming

Last modified: April 9, 2021, 1:19 p.m.

Allen Holub provides background material for understanding teh C language and examines such advanced topics as sophisticated uses of pointers and subroutines with a variable number of arguments. With a rudimentary knowledge of C, you can use this book to supplement a regular textbook for an in-depth understanding of the language.

Among its key features, this practical book:

  • describes the various parts of the C compiler and how they work with one another
  • presents assembly language in a way that shows why things are done in certain ways in C
  • discusses the code that a C compiler typically generates
  • shows how to design and write large C programs
  • covers pointers from a realistic perspective including their uses and multiple levels of indirection
  • explores recursion and how it works
  • analyzes complex debugging issues and the solutions to these problems

  1. The C Compiler
    1. The Parts of a Compiler
      1. The Preprocessor
      2. The Compiler
      3. The Assembler
      4. The Linker, or Link Editor
      5. Librarians and Libraries
      6. Library Maintenance
    2. Modular Programming
    3. Other Useful Programs
      1. Grep
      2. Lint
      3. Make
    4. Exercises
  2. Binary Arithmetic
    1. Bases and Powers
    2. Converting Bases
    3. Addition and Subtraction
    4. Negative Numbers
    5. Shifts, Multiplication and Division
      1. Shifting
      2. Multiplication
      3. Division
      4. Truncation, Overflow and Speed
    6. Boolean Algebra
      1. The Logical Operators
    7. Simple Identities
      1. Inverting Expressions and DeMorgan's Theorem
      2. Boolean Algebraic Simplification
    8. Bit-wise Operators and Masks
      1. AND, OR, XOR, NOT
      2. Masks
    9. The Comma, Equals, and Conditional Operatos
    10. Bugs
    11. Exercises
  3. Assembly Language
    1. What is Assembler?
    2. Memory Organization and Alignment
    3. Registers and Machine Organization
    4. Addressing Modes
      1. Register Direct Addressing
      2. Memory Direct Addressing
      3. Immediate Addressing
      4. Indirect Addressing
      5. Indirect Addressing with Auto-postincrement
      6. Indirect Addressing with Auto-predecrement
      7. Indexed Addressing
    5. Instruction Set
      1. The Move Instruction
      2. Arithmetic Instructions
      3. Jump Instructions
      4. Subroutine Calls and Stacks
    6. Labels
    7. Comments
    8. Pseudo-ops and Static Initializers
    9. Exercises
  4. Code Generation and Subroutine Linkage
    1. Subroutine Calling
    2. The Stack Frame
    3. Using Casts in Subroutine Calls
    4. The Return Value
    5. The Symbol Table
    6. Control Flow: if/else, while, and for
    7. Switches
    8. Relocatable Code
    9. Exercises
  5. Structured Programming and Stepwise Refinement
    1. Writing a Program is Writing
    2. Program Organization
    3. Commenting and Formatting
      1. White Space and Indenting
      2. How to Write Comments
      3. Where to Put Comments
      4. Do Not Explain the Obvious
      5. Variable Names
    4. Global Variables and Access Routines
    5. Portability
    6. Things to Avoid
      1. Abuse of the goto: Unstructred Programming
      2. Misuses of the #define
      3. Switches
    7. If/else
    8. A C Style Sheet
    9. Exercises
  6. Pointers
    1. Simple Pointers
    2. Pointers and Array Names
    3. Pointer Arithmetic
    4. The Square Bracket Notation
    5. Implicit Characters Arrays: Initialization
    6. Exercises
  7. Advanced Pointers
    1. Complex Declarations
    2. Function Pointers
    3. Going in the Other Direction
    4. Typedefs
    5. Using Pointers to Talk to Hardware
      1. Absolute Memory Addressing
      2. Directly Accessing the IBM PC Video Memory from C
      3. Using Structures to Model Hardware
      4. Hardware Interfacing and Portability
    6. Exercises
  8. Recursion and Compiler Design
    1. How Recursion Works
    2. The Anatomy of a Compiler
    3. Grammars: Representing Computer Language
    4. Parsing with a Grammar
    5. A Recursive Descent Parser
    6. Improving the Parser
    7. Exercises
  9. The Anatomy of Printf()
    1. Stacks Revisited
    2. printf()
    3. Macros used by doprnt()
    4. Fetching Arguments off the Stack
    5. doprnt(): The Code
    6. Structured Programming Considerations
    7. ltos()
    8. dtos()
    9. Exercises
  10. Debugging
    1. Using printf() for Debugging
    2. Comments Do Not Nest
    3. Lvalue Required
    4. Operator-related Errors
      1. Order-of-Precedence Errors
      2. Order-of-Evaluation Errors
      3. Using the Wrong Operator
    5. Control Flow
      1. Unwanted Null statements, Unattached { }
      2. If/else Binding Incorrectly
    6. Macros
      1. Macro Order of Precedence Problems
      2. Unexpected Macro Argument Substitution
      3. Macros with Side Effects
    7. An Int Is Not 16 Bits Wide
      1. Precision
      2. Incomplete Statements in a Macro
      3. Masks
      4. A Constant is an Int
    8. Automatic type conversion problems
    9. Missing or Implied Extern Statements
    10. I/O
      1. Scanf()
      2. Getc is a Buffered Function
      3. Translated Versus Untranslated I/O
    11. Optimizers discarding operations
    12. Exercises
  • Bibliography
  • Appendix A: Order of Precedence Chart
  • Appendix B: Shell Sort

Reviews

The C Companion

Reviewed by Roland Buresund

Excellent ********** (10 out of 10)

Last modified: May 21, 2007, 3:25 a.m.

The best book ever written about the C language. Priceless and immortal. Buy it, you need it.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required