The Art of C++
Explaining complex code examples, this book demonstrates the artistry of C++, and includes a chapter, on A C++ Interpreter.
1017953315
The Art of C++
Explaining complex code examples, this book demonstrates the artistry of C++, and includes a chapter, on A C++ Interpreter.
49.0
In Stock
5
1


Paperback
$49.00
-
SHIP THIS ITEMIn stock. Ships in 1-2 days.PICK UP IN STORE
Your local store may have stock of this item.
Available within 2 business hours
Related collections and offers
49.0
In Stock
Overview
Explaining complex code examples, this book demonstrates the artistry of C++, and includes a chapter, on A C++ Interpreter.
Product Details
ISBN-13: | 9780072255126 |
---|---|
Publisher: | McGraw-Hill/Osborne Media |
Publication date: | 04/07/2004 |
Series: | Programming Series |
Pages: | 401 |
Product dimensions: | 7.28(w) x 9.18(h) x 0.89(d) |
Table of Contents
Preface | xv | |
Chapter 1 | The Power of C++ | 1 |
A Terse yet Rich Syntax | 2 | |
Powerful Libraries | 3 | |
The STL | 3 | |
The Programmer Is in Control | 4 | |
Detailed Control | 4 | |
Operator Overloading | 5 | |
A Clean, Streamlined Object Model | 5 | |
The Legacy of C++ | 6 | |
Chapter 2 | A Simple Garbage Collector for C++ | 7 |
Comparing the Two Approaches to Memory Management | 8 | |
The Pros and Cons of Manual Memory Management | 9 | |
The Pros and Cons of Garbage Collection | 10 | |
You Can Have It Both Ways | 11 | |
Creating a Garbage Collector in C++ | 11 | |
Understanding the Problem | 11 | |
Choosing a Garbage Collection Algorithm | 12 | |
Reference Counting | 12 | |
Mark and Sweep | 13 | |
Copying | 13 | |
Which Algorithm? | 13 | |
Implementing the Garbage Collector | 14 | |
To Multithread or Not? | 14 | |
When to Collect Garbage? | 15 | |
What About auto_ptr? | 15 | |
A Simple C++ Garbage Collector | 16 | |
An Overview of the Garbage Collector Classes | 28 | |
GCPtr In Detail | 29 | |
GCPtr Data Members | 30 | |
The findPtrInfo() Function | 31 | |
The GCIterator typedef | 31 | |
The GCPtr Constructor | 31 | |
The GCPtr Destructor | 33 | |
Collect Garbage with collect() | 33 | |
The Overloaded Assignment Operators | 35 | |
The GCPtr Copy Constructor | 37 | |
The Pointer Operators and Conversion Function | 38 | |
The begin() and end() Functions | 40 | |
The shutdown() Function | 40 | |
Two Utility Functions | 41 | |
GCInfo | 41 | |
Iter | 42 | |
How to Use GCPtr | 44 | |
Handling Allocation Exceptions | 46 | |
A More Interesting Example | 46 | |
Allocating and Discarding Objects | 49 | |
Allocating Arrays | 51 | |
Using GCPtr with Class Types | 53 | |
A Larger Demonstration Program | 55 | |
Load Testing | 62 | |
Some Restrictions | 64 | |
Some Things to Try | 65 | |
Chapter 3 | Multithreading in C++ | 67 |
What Is Multithreading? | 68 | |
Multithreading Changes the Architecture of a Program | 69 | |
Why Doesn't C++ Contain Built-In Support for Multithreading? | 69 | |
What Operating System and Compiler? | 70 | |
An Overview of the Windows Thread Functions | 70 | |
Creating and Terminating a Thread | 71 | |
The Visual C++ Alternatives to CreateThread() and ExitThread() | 72 | |
Suspending and Resuming a Thread | 73 | |
Changing the Priority of a Thread | 74 | |
Obtaining the Handle of the Main Thread | 75 | |
Synchronization | 76 | |
Creating a Thread Control Panel | 79 | |
The Thread Control Panel | 80 | |
A Closer Look at the Thread Control Panel | 85 | |
Demonstrating the Control Panel | 91 | |
A Multithreaded Garbage Collector | 96 | |
The Additional Member Variables | 97 | |
The Multithreaded GCPtr Constructor | 97 | |
The TimeOutExc Exception | 99 | |
The Multithreaded GCPtr Destructor | 100 | |
The gc() Function | 100 | |
The isRunning() Function | 101 | |
Synchronizing Access to gclist | 101 | |
Two Other Changes | 102 | |
The Entire Multithreaded Garbage Collector | 102 | |
Using the Multithreaded Garbage Collector | 116 | |
Some Things to Try | 118 | |
Chapter 4 | Extending C++ | 119 |
Why Use a Translator? | 120 | |
The Experimental Keywords | 121 | |
The foreach Loop | 122 | |
The cases Statement | 123 | |
The typeof Operator | 124 | |
The repeat/until Loop | 125 | |
A Translator for Experimental C++ Features | 125 | |
Using the Translator | 135 | |
How the Translator Works | 136 | |
The Global Declarations | 136 | |
The main() Function | 137 | |
The gettoken() and skipspaces() Functions | 139 | |
Translating the foreach Loop | 142 | |
Translating the cases Statement | 145 | |
Translating the typeof Operator | 148 | |
Translating a repeat/until Loop | 149 | |
A Demonstration Program | 151 | |
Some Things to Try | 158 | |
Chapter 5 | An Internet File Downloader | 159 |
The WinINet Library | 160 | |
The File Downloader Subsystem | 161 | |
General Theory of Operation | 166 | |
The download() Function | 167 | |
The ishttp() Function | 172 | |
The httpverOK() Function | 173 | |
The getfname() Function | 174 | |
The openfile() Function | 174 | |
The update() Function | 175 | |
The Download Header File | 176 | |
Demonstrating the File Downloader | 177 | |
A GUI-Based Downloader | 178 | |
The WinDL Code | 179 | |
How WinDL Works | 185 | |
Some Things to Try | 186 | |
Chapter 6 | Financial Calculations in C++ | 187 |
Finding the Payments for a Loan | 188 | |
Finding the Future Value of an Investment | 190 | |
Finding the Initial Investment Required to Achieve a Future Value | 192 | |
Finding the Initial Investment Needed for a Desired Annuity | 194 | |
Finding the Maximum Annuity for a Given Investment | 196 | |
Finding the Remaining Balance on a Loan | 197 | |
Some Things to Try | 199 | |
Chapter 7 | Al-Based Problem Solving | 201 |
Representation and Terminology | 202 | |
Combinatorial Explosions | 204 | |
Search Techniques | 206 | |
Evaluating a Search | 206 | |
The Problem | 206 | |
A Graphic Representation | 207 | |
The FlightInfo Structure and the Search Class | 207 | |
The Depth-First Search | 211 | |
The match() Function | 217 | |
The find() Function | 217 | |
The findroute() Function | 218 | |
Displaying the Route | 219 | |
An Analysis of the Depth-First Search | 220 | |
The Breadth-First Search | 220 | |
An Analysis of the Breadth-First Search | 223 | |
Adding Heuristics | 224 | |
The Hill-Climbing Search | 224 | |
An Analysis of Hill Climbing | 230 | |
The Least-Cost Search | 231 | |
An Analysis of the Least-Cost Search | 232 | |
Finding Multiple Solutions | 233 | |
Path Removal | 234 | |
Node Removal | 235 | |
Finding the "Optimal" Solution | 243 | |
Back to the Lost Keys | 249 | |
Some Things to Try | 253 | |
Chapter 8 | Building a Custom STL Container | 255 |
A Brief Review of the STL | 256 | |
Containers | 257 | |
Algorithms | 257 | |
Iterators | 257 | |
Other STL Entities | 257 | |
Custom Container Requirements | 258 | |
General Requirements | 258 | |
Additional Sequence Container Requirements | 260 | |
Associative Container Requirements | 260 | |
Creating a Range-Selectable, Dynamic Array Container | 261 | |
How RangeArray Works | 261 | |
The Entire RangeArray Class | 263 | |
The RangeArray Class in Detail | 275 | |
Some RangeArray Sample Programs | 288 | |
Some Things to Try | 299 | |
Chapter 9 | A Mini C++ Interpreter | 301 |
Interpreters versus Compilers | 302 | |
An Overview of Mini C++ | 303 | |
The Mini C++ Specifications | 304 | |
Some Mini C++ Restrictions | 305 | |
An Informal Theory of C++ | 306 | |
C++ Expressions | 307 | |
Defining an Expression | 307 | |
The Expression Parser | 309 | |
The Parser Code | 309 | |
Tokenizing the Source Code | 324 | |
Displaying Syntax Errors | 330 | |
Evaluating an Expression | 331 | |
The Mini C++ Interpreter | 333 | |
The main() Function | 354 | |
The Interpreter Prescan | 356 | |
The interp() Function | 359 | |
Handling Local Variables | 362 | |
Calling User-Defined Functions | 364 | |
Assigning Values to Variables | 366 | |
Executing an if Statement | 368 | |
The switch and break Statements | 370 | |
Processing a while Loop | 372 | |
Processing a do-while Loop | 373 | |
The for Loop | 375 | |
Handling cin and cout Statements | 377 | |
The Mini C++ Library Functions | 379 | |
The mccommon.h Header File | 381 | |
Compiling and Linking the Mini C++ Interpreter | 383 | |
Demonstrating Mini C++ | 383 | |
Improving Mini C++ | 393 | |
Expanding Mini C++ | 393 | |
Adding New C++ Features | 394 | |
Adding Ancillary Features | 394 | |
Index | 395 |
From the B&N Reads Blog
Page 1 of