C++ In a Nutshell: A Desktop Quick Reference (In a Nutshell and over 2 million other books are available for Amazon Kindle . Learn more


or
Sign in to turn on 1-Click ordering.
Trade in Yours
For a £2.08 Gift Card
Trade in
More Buying Choices
Have one to sell? Sell yours here
Sorry, this item is not available in
Image not available for
Colour:
Image not available

 
Start reading C++ In a Nutshell on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

C++ In a Nutshell: A Desktop Quick Reference (In a Nutshell (O'Reilly)) [Paperback]

Ray Lischner
4.3 out of 5 stars  See all reviews (3 customer reviews)
Price: £25.99 & FREE Delivery in the UK. Details
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
Only 2 left in stock (more on the way).
Dispatched from and sold by Amazon. Gift-wrap available.
Want it tomorrow, 25 Sep.? Choose Express delivery at checkout. Details

Formats

Amazon Price New from Used from
Kindle Edition £20.08  
Hardcover --  
Paperback £25.99  
Trade In this Item for up to £2.08
Trade in C++ In a Nutshell: A Desktop Quick Reference (In a Nutshell (O'Reilly)) for an Amazon Gift Card of up to £2.08, which you can then spend on millions of items across the site. Trade-in values may vary (terms apply). Learn more

Book Description

18 May 2003 059600298X 978-0596002985 1

To-the-point, authoritative, no-nonsense solutions have always been a trademark of O'Reilly books. The In a Nutshell books have earned a solid reputation in the field as the well-thumbed references that sit beside the knowledgeable developer's keyboard. C++ in a Nutshell lives up to the In a Nutshell promise. C++ in a Nutshell is a lean, focused reference that offers practical examples for the most important, most often used, aspects of C++.C++ in a Nutshell packs an enormous amount of information on C++ (and the many libraries used with it) in an indispensable quick reference for those who live in a deadline-driven world and need the facts but not the frills.The book's language reference is organized first by topic, followed by an alphabetical reference to the language's keywords, complete with syntax summaries and pointers to the topic references. The library reference is organized by header file, and each library chapter and class declaration presents the classes and types in alphabetical order, for easy lookup. Cross-references link related methods, classes, and other key features. This is an ideal resource for students as well as professional programmers.When you're programming, you need answers to questions about language syntax or parameters required by library routines quickly. What, for example, is the C++ syntax to define an alias for a namespace? Just how do you create and use an iterator to work with the contents of a standard library container? C++ in a Nutshell is a concise desktop reference that answers these questions, putting the full power of this flexible, adaptable (but somewhat difficult to master) language at every C++ programmer's fingertips.


Frequently Bought Together

C++ In a Nutshell: A Desktop Quick Reference (In a Nutshell (O'Reilly)) + C++ Pocket Reference
Price For Both: £30.87

Buy the selected items together
  • C++ Pocket Reference £4.88


Product details

  • Paperback: 810 pages
  • Publisher: O'Reilly Media; 1 edition (18 May 2003)
  • Language: English
  • ISBN-10: 059600298X
  • ISBN-13: 978-0596002985
  • Product Dimensions: 3.5 x 15.2 x 22.9 cm
  • Average Customer Review: 4.3 out of 5 stars  See all reviews (3 customer reviews)
  • Amazon Bestsellers Rank: 475,220 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Author

Discover books, learn about writers, and more.

Product Description

About the Author

Ray Lischner began his career as a software developer, but dropped out of the corporate rat race to become an author. He started using C++ in the late 1980s, working at a company that was rewriting its entire product line in C++. Over the years, he has witnessed the evolution of C++ from cfront to native compilers to integrated development environments to visual, component-based tools. Ray has taught C++ at Oregon State University. He is the author of Delphi in a Nutshell and O'Reilly's upcoming C++ in a Nutshell, as well as other books.

Excerpt. © Reprinted by permission. All rights reserved.

Chapter 4 – Statements

Statements define and control what a program does. This chapter describes the syntax and rules for C++ statements: expressions, loops, selection, and control. The statement syntax rules apply recursively, and wherever a statement is called for, you can use (almost) any of the statements in this chapter.

The syntax descriptions in this chapter are informal. See Chapter 12 for a precise BNF grammar.

Expression Statements
An expression statement computes an expression, such as a function call or assignment. The expression result is discarded, so the expression is typically evaluated for its side effects. (See Chapter 3 for details about expressions.) The statement syntax is simply an optional expression followed by a semicolon:
expr ;
or:
;

A statement with no expression is called a null statement. Null statements are most often used for loops when no code is needed in the loop body.

Here are several examples of expression statements:

42; // Valid but pointless
cout << 42; // More typical
x = y * z; // Remember that assignment is an expression
; // Null statementDeclarations

A declaration can appear anywhere a statement appears, and certain statements permit additional declarations within those statements.

Declarations made in a substatement (of a selection or loop statement) are limited in scope to the substatement, even if the substatement is not a compound statement. For example, the following statement:
while ( test( ) )
int x = init( );

is equivalent to:
while ( test( ) ) {
int x = init( );
}
The first example uses a declaration as the entire loop body, and the second uses a compound statement (enclosing the loop body in curly braces). In both cases, though, the scope of x is limited to the body of the while loop.

Declaration Statements
A simple declaration can appear wherever a statement can be used. You can declare an object, a type, or a namespace alias. You can also write a using declaration or using directive. You can declare a function, but not define a function, although there is rarely any reason to declare a function locally. You cannot define a namespace or declare a template.

In traditional C programming, declarations appear at the start of each block or compound statement. In C++ (and in the C99 standard), declarations can appear anywhere a statement can, which means you can declare variables close to where they are used. Example 4-1 shows examples of how declarations can be mixed with statements.


Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?


Customer Reviews

3 star
0
2 star
0
1 star
0
4.3 out of 5 stars
4.3 out of 5 stars
Most Helpful Customer Reviews
7 of 7 people found the following review helpful
Format:Paperback
This book is concise, readable, and useful. As it makes clear on the cover, this is a reference book, and dives straight into very intense details of the syntax of C++. It is meant as the kind of book you can check when code that you thought should work isn't compiling, or when you want to know the proper way to write something particular. In fact, it reads quite like a plain-English version of the C++ standard itself.

It is perhaps surprising that the order of the chapters matches the abstraction level of each topic; starting with the parsing of characters in a source file, and working up through simple expressions to functions, classes, and finally to the standard libraries provided to assist you in common tasks. This may not be the order that the reader becomes interested in the topics, but it reflects the nature of this book as a reference rather than a cover-to-cover gripping read.

Even that first chapter contains treasures, such as the importance of spaces in nested template declarations, where ">>" would be parsed incorrectly. As well as statements of fact about the language, it includes a few human touches like using words that most of us recognise ("source file", when the standard says "translation unit"), and even advice not to use trigraphs; an obsolete part of the language which is still valid. Later, it warns about the safety of iterators, which can become almost as invalid as pointers, but doesn't spend long on stylistic advice, a bit more of which might be welcome. It dwells more on templates and containers, perhaps because they are less familiar to many readers.

There are lots of short examples of code, particularly in explaining how certain keywords are used and misused.
Read more ›
Comment | 
Was this review helpful to you?
11 of 12 people found the following review helpful
4.0 out of 5 stars Nutshell Series 14 May 2004
By A Customer
Format:Paperback
Like the other books (I have looked at) in the 'In a Nutshell' series this book provides a clear introduction into the language in question, then provides a clear and concise referance section.
Having said that it provides a clear introduction I don't think this book is for beginners, rather it is for a programmer who wants to learn another language, or for a C++ programmer would would like a referance book.
I brought it, am happy with it, and I doubt I could find better.
Comment | 
Was this review helpful to you?
5.0 out of 5 stars Please update 27 July 2013
By uj
Format:Paperback
This is an excellent quick reference I use again and again. Hopefully it will be updated for C++ 11 anytime soon.
Comment | 
Was this review helpful to you?
Most Helpful Customer Reviews on Amazon.com (beta)
Amazon.com: 4.5 out of 5 stars  27 reviews
47 of 48 people found the following review helpful
5.0 out of 5 stars Very useful 11 Jun 2003
By uniq - Published on Amazon.com
Format:Paperback
This is an excellent reference designed to give you precise definitions and usage for the C++ language features and library according to the C++ Standard. Unless you are a novice, it will save you time. In the past, when I needed to lookup something, I used to gladly dive into the Stroustrup's "C++ Programming Language" or Josuttis's "The C++ Standard Library". While indispensable and authoritative, these volumes are *NOT* designed for easy reference work; reading them takes time, and what should have been a 30-second lookup inevitably turned into a 30-minute reading. The "C++ In A Nutshell" helps to solve this problem, in addition to putting all the relevant resources at your fingertips in one volume.
27 of 27 people found the following review helpful
5.0 out of 5 stars Excellent reference for the practicing programmer 13 Nov 2003
By Terry A. Smith - Published on Amazon.com
Format:Paperback
Most of the "reference" books I've seen for C++ have been more advanced primers (lippman/lajoie, pratta, josuttis). This is the first book I've seen for someone who knows C++, has been using it for some time, and needs a library and language reference. A welcome addition to my desk, especially since I learned C++ in 1992 and sometimes still need a gentle push away from archaic usage.
The language reference is concise but appears complete, and I disagree with the reviewer who said it is poorly organized (the library reference is alphabetical by library, the language reference follows the same convention everyone else does: Basics,Declarations,Expressions,Statements,Functions,Classes,Templates,I/O,Containers). The library reference is very, very valuable, often providing usage and code snippets as well as syntax.
This won't replace all the books on your shelf (you do have Effective C++ and More Effective C++, right?) but it will be a well used reference if you are a professional software guy (or faking it).
17 of 18 people found the following review helpful
5.0 out of 5 stars Excellent reference 20 Oct 2003
By Jason Rennie - Published on Amazon.com
Format:Paperback
O'Reilly has done it again. C++ in a Nutshell is a great reference. The first 275 pages are a technical introduction to the language. The next 50 pages provide a preprocessor and language reference. The final 400 pages provide a reference to the library. Those last 400 pages are the real gem. Sections are organized by header file (e.g. <sstream>). A full prototype of each major class is provided and each function is explained individually. Also, the index is complete, so it's easy to find information on a class or function you're looking for. Descriptions are complete, but concise---all the information you need and not a char more.
This book isn't for beginners, but if you've had experience with C or C++ and are looking for a complete, well-organized reference to C++, this is the book to get.
11 of 13 people found the following review helpful
5.0 out of 5 stars Excellent reference 19 Mar 2006
By R. Hord Jr. - Published on Amazon.com
Format:Paperback|Verified Purchase
I always like O'Reilly books and are usually what I purchase. The "In A Nutshell" may be misleading to some. Just think of it as "C++ A Language & Library Reference." If you are a beginner looking for a how to, this isn't the one for you. "Thinking in C++" by Bruce Eckel (great book), or "Practical C++ Programming" would be the one a beginner would want. However, when you are ready to explore the inter-details about what C++ classes provides, this would be a good one to add to your collection. The first half describes C++ in general, while the last half details the language reference. I like how the reference is structured, grouped by the easy to find header declaration at the bottom of the page. Quickly finding what you need is a great feature here. You can only do so much "std::cout << "hi" << std::endl; without a reference and this one covers the missing details. Not for beginners, but an excellent reference.
6 of 6 people found the following review helpful
5.0 out of 5 stars An excellent Nutshell. C++? A+! 7 July 2003
By "spoon_" - Published on Amazon.com
Format:Paperback
I bought this to replace another C/C++ reference book. The other book was abysmal, with poor organisation, lacks of detail, depth and clarity. The Nutshell is a refreshing delight. It covers everything about C++, from the ground up. It's not a tutorial, but anyone familiar with C should be able to grasp C++ from this reference. Very detailed, even including a BNF grammar of the language. Excellent.
Were these reviews helpful?   Let us know
Search Customer Reviews
Only search this product's reviews

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
 

Search Customer Discussions
Search all Amazon discussions
   


Look for similar items by category


Feedback