Skip to Main Content
C++ In a Nutshell
book

C++ In a Nutshell

by Ray Lischner
May 2003
Intermediate to advanced content levelIntermediate to advanced
808 pages
32h 24m
English
O'Reilly Media, Inc.
Content preview from C++ In a Nutshell

Comments

Comments start with /* and end with */. These comments do not nest. For example:

/* this is a comment /* still a comment */
int not_in_a_comment;

A comment can also start with //, extending to the end of the line. For example:

const int max_widget = 42; // Largest size of a widget

Within a /* and */ comment, // characters have no special meaning. Within a // comment, /* and */ have no special meaning. Thus, you can “nest” one kind of comment within the other kind. For example:

/* Comment out a block of code:
const int max_widget = 42; // Largest size of a widget
*/

///* Inhibit the start of a block comment
const int max_widget = 10; // Testing smaller widget limit
//*/

A comment is treated as whitespace. For example, str/*comment*/ing describes two separate tokens, str and ing.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ High Performance

C++ High Performance

Viktor Sehr, Björn Andrist
Optimized C++

Optimized C++

Kurt Guntheroth
Mastering C++ Programming

Mastering C++ Programming

Jeganathan Swaminathan

Publisher Resources

ISBN: 059600298XSupplemental ContentErrata Page