Expert C Programming

Book description

This book is for the knowledgeable C programmer, this is a second book that gives the C programmers advanced tips and tricks. This book will help the C programmer reach new heights as a professional. Organized to make it easy for the reader to scan to sections that are relevant to their immediate needs.

Table of contents

  1. Cover Page
  2. About This eBook
  3. Title Page
  4. Copyright Page
  5. Dedication
  6. Contents
  7. Preface
  8. Acknowledgments
  9. Introduction
    1. The $20 Million Bug
    2. Convention
    3. Some Light Relief—Tuning File Systems
  10. 1. C Through the Mists of Time
    1. The Prehistory of C
    2. Early Experiences with C
    3. The Standard I/O Library and C Preprocessor
    4. K&R C
    5. The Present Day: ANSI C
    6. It’s Nice, but Is It Standard?
    7. Translation Limits
    8. The Structure of the ANSI C Standard
    9. Reading the ANSI C Standard for Fun, Pleasure, and Profit
    10. How Quiet is a “Quiet Change”?
    11. Some Light Relief—The Implementation-Defined Effects of Pragmas . . .
  11. 2. It’s Not a Bug, It’s a Language Feature
    1. Why Language Features Matter—The Way the Fortran Bug Really Happened!
    2. Sins of Commission
    3. Sins of Mission
    4. Sins of Omission
    5. Some Light Relief—Some Features Really Are Bugs!
  12. 3. Unscrambling Declarations in C
    1. Syntax Only a Compiler Could Love
    2. How a Declaration Is Formed
    3. The Precedence Rule
    4. Unscrambling C Declarations by Diagram
    5. typedef Can Be Your Friend
    6. Difference Between typedef int x[10] and #define x int[10]
    7. What typedef struct foo { ... foo; } foo; Means
    8. The Piece of Code that Understandeth All Parsing
    9. Some Light Relief—Software to Bite the Wax Tadpole...
  13. 4. The Shocking Truth: C Arrays and Pointers Are NOT the Same!
    1. Arrays Are NOT Pointers!
    2. Why Doesn’t My Code Work?
    3. What’s a Declaration? What’s a Definition?
    4. How Arrays and Pointers Are Accessed
    5. Diagram A A Subscripted Array Reference
    6. Diagram B A Pointer Reference
    7. Diagram C A Subscripted Pointer Reference
    8. Match Your Declarations to the Definition
    9. Other Differences Between Arrays and Pointers
    10. Some Light Relief—Fun with Palindromes!
  14. 5. Thinking of Linking
    1. Libraries, Linking, and Loading
    2. The Benefits of Dynamic Linking
    3. Five Special Secrets of Linking with Libraries
    4. Watch Out for Interpositioning
    5. Generating Linker Report Files
    6. Some Light Relief—Look Who’s Talking: Challenging the Turing Test
  15. 6. Poetry in Motion: Runtime Data Structures
    1. a.out and a.out Folklore
    2. Segments
    3. What the OS Does with Your a.out
    4. What the C Runtime Does with Your a.out
    5. What Happens When a Function Gets Called: The Procedure Activation Record
    6. The auto and static keywords
    7. Threads of Control
    8. setjmp and longjmp
    9. The Stack Segment Under UNIX
    10. The Stack Segment Under MS-DOS
    11. Helpful C Tools
    12. Some Light Relief—Programming Puzzles at CMU
    13. For Advanced Students Only
  16. 7. Thanks for the Memory
    1. The Intel 80x86 Family
    2. The Intel 80x86 Memory Model and How It Got That Way
    3. Virtual Memory
    4. Cache Memory
    5. The Data Segment and Heap
    6. Memory Leaks
    7. Bus Error, Take the Train
    8. Some Light Relief—The Thing King and the Paging Game
  17. 8. Why Programmers Can’t Tell Halloween from Christmas Day
    1. The Potrzebie System of Weights and Measures
    2. Making a Glyph from Bit Patterns
    3. Types Changed While You Wait
    4. Prototype Painfulness
    5. Getting a Char Without a Carriage Return
    6. Implementing a Finite State Machine in C
    7. Software Is Harder than Hardware!
    8. How and Why to Cast
    9. Some Light Relief—The International Obfuscated C Code Competition
  18. 9. More about Arrays
    1. When an Array Is a Pointer
    2. Why the Confusion?
    3. Why C Treats Array Parameters as Pointers
    4. Indexing a Slice
    5. Arrays and Pointers Interchangeability Summary
    6. C Has Multidimensional Arrays...
    7. ...But Every Other Language Calls Them “Arrays of Arrays”
    8. How Multidimensional Arrays Break into Components
    9. How Arrays Are Laid Out in Memory
    10. How to Initialize Arrays
    11. Some Light Relief—Hardware/Software Trade-Offs
  19. 10. More About Pointers
    1. The Layout of Multidimensional Arrays
    2. An Array of Pointers Is an “Iliffe Vector”
    3. Using Pointers for Ragged Arrays
    4. Passing a One-Dimensional Array to a Function
    5. Using Pointers to Pass a Multidimensional Array to a Function
    6. Using Pointers to Return an Array from a Function
    7. Using Pointers to Create and Use Dynamic Arrays
    8. Some Light Relief—The Limitations of Program Proofs
  20. 11. You Know C, So C++ is Easy!
    1. Allez-OOP!
    2. Abstraction—Extracting Out the Essential Characteristics of a Thing
    3. Encapsulation—Grouping Together Related Types, Data, and Functions
    4. Showing Some Class—Giving User-Defined Types the Same Privileges as Predefined Types
    5. Availability
    6. Declarations
    7. How to Call a Method
    8. Inheritance—Reusing Operations that Are Already Defined
    9. Multiple Inheritance—Deriving from Two or More Base Classes
    10. Overloading—Having One Name for the Same Action on Different Types
    11. How C++ Does Operator Overloading
    12. Input/Output in C++
    13. Polymorphism—Runtime Binding
    14. Explanation
    15. How C++ Does Polymorphism
    16. Fancy Pants Polymorphism
    17. Other Corners of C++
    18. If I Was Going There, I Wouldn’t Start from Here
    19. It May Be Crufty, but It’s the Only Game in Town
    20. Some Light Relief—The Dead Computers Society
    21. Some Final Light Relief—Your Certificate of Merit!
    22. Further Reading
  21. Appendix: Secrets of Programmer Job Interviews
    1. Silicon Valley Programmer Interviews
    2. How Can You Detect a Cycle in a Linked List?
    3. What Are the Different C Increment Statements For?
    4. How Is a Library Call Different from a System Call?
    5. How Is a File Descriptor Different from a File Pointer?
    6. Write Some Code to Determine if a Variable Is Signed or Not
    7. What Is the Time Complexity of Printing the Values in a Binary Tree?
    8. Give Me a String at Random from This File
    9. Some Light Relief—How to Measure a Building with a Barometer
    10. Further Reading
  22. Index
  23. Code Snippets

Product information

  • Title: Expert C Programming
  • Author(s): Peter van der Linden
  • Release date: June 1994
  • Publisher(s): Pearson
  • ISBN: 9780131774292