Re: C++-books
On 5/23/2011 12:46 PM, Stefan Ram wrote:
There are some important C++-topics not covered in all
C++-books. So I tried to find a book that covers all of
the following topics (with no success, but - of course -
I am not able to access all the books):
- deviations of C++-arithmetics (int and double) from
mathematics, so that the reader can, e.g., assess the
possible values of ?2000000000< 3000000000? in C++
- sequence points and undefined behavior
- Argument-dependent name lookup
- RAII
- The rule of the three
- exception-safe programming
Could one say that a C++ text book is poor unless it
covers at least /all/ of the above topics?
No.
First off, the int(2e9) > int(3e9) (you did mean '>', did you not?) is
not specific to C++.
Second... Sequence points? Really? I don't know. A mention might be
OK, but full coverage? <shrug> Just give the rules, like "don't change
the object's value twice in a single expression", or "remember that
arguments are evaluated in an undetermined order". Tease them, get them
interested to learn more, send them to c.l.c++[.moderated]. :*)
Third, ADL. Probably covered in some book, like Koenig's "Accelerated
C++" (I don't have a copy).
RAII? Hmm... Is it C++ specific?
Then, the Rule of Three. Most like is covered in the "Effective C++".
And lastly, exception-safe programming is a technique, not a language
specific topic. Just like multithreading. There is no particular need
to have that in a C++ book, although a C++ book about it might actually
be useful, and there are some that exist.
Are there any topics you would like to add or remove from
the above ?check list? for books?
I'd remove ADL. Or at least I'd place it in the "advanced" section.
What throwing an exception does (like stack unwinding) should be enough
for a thoughtful programmer to understand that only local objects are
destructed properly. Specifics of some arithmetic (and their
platform-dependence) should be mentioned, perhaps, but not too deeply,
since it's specific to the platform, let them figure it out by testing
or by reading the compiler docs. A properly written program does not
have undefined behavior, so UB does deserve a mention in a couple of
contexts with a footnote containing a link on where to learn more, if
the reader so desires.
I'd definitely add the library as the main focus after the language is
covered. Structure the book like the Standard, just use a better
(easier) language to present the material.
> What does one need to know
about C++ before one can honestly call oneself a
?C++ programmer/developer??
The grammar, the library (some of it). The rest is not C++ specific.
The book *might* contain some idioms and techniques, but that's not
generally required to make it a C++ textbook since techniques worth
knowing (and bragging about knowing) are often quite language-neutral.
[..]
V
--
I do not respond to top-posted replies, please don't ask