Mike and Phani's Essential C++ Techniques 195
Mike and Phani's Essential C++ Techniques | |
author | Michael Hyman and Phani Vaddadi |
pages | 239 |
publisher | APress |
rating | 2/10 |
reviewer | Chris Thompson |
ISBN | 1893115046 |
summary | This book is useless to any other than the beginning Visual C++ 6.0 students. |
The major problem
This book has one killer problem: It is not aimed at C++ programmers. Let me be more specific here; it is not aimed at ANSI C++ programmers. Instead, it is aimed at Microsoft Visual C++ 6.0 programmers.Is this a big deal? Yes. The cover of the book is rife with mentions of C++. It even mentions ANSI C++. There is one, and only one, reference to Visual C++ on the cover of the book. Even inside, the index lists only three references to Visual Studio, none to Visual C++. With quotes such as 'Hundreds of tips and techniques for advanced C++ programmers' on the cover, I was very surprised to realise this book is for Visual C++ 6.0 users only. At best, the cover of this book is misleading.
The rest of this review (and the book's rating) assumes you are still interested in the book. You therefore use only Visual C++ 6.0 and have no plans to upgrade.
Other problems
For a book apparently aimed at intermediate and advanced programmers, this book contains a lot of tips that any experienced beginner should already know. Techniques such as ensuring you never return a pointer to an automatic variable really have no place in a book with the stated audience. Really, this book would be more suited to programmers who were still learning C++.
Except there are a number of other issues that make this book poorly suited to people learning C++. Instead of using standard C++ strings, this book chooses NULL-terminated C strings. Files are not included the C++ way (cstdio instead of stdio.h, iostream instead of iostream.h). The STL is not mentioned at all, with dynamic arrays having their own chapter rather than a simple mention of vectors and with an entire chapter devoted to code for sorting instead of showing the programmer how to use the STL sorting algorithms. The smart pointers? Either use the built-in autoptr or use boost.org's vastly superior implementation.
Some good stuff
This book is not completely without redeeming qualities. Many of these techniques are good and useful. If you are a new Visual C++ 6.0 programmer and you are learning from a substandard text, you may find this book covers some of the shortfalls of your other textbook. Similarly, if you are taking a class in C++ and your instructor is particularly lousy, this book could help you out.
Summary
Mike and Phani's Essential C++ Techniques is useless to any other than the beginning Visual C++ 6.0 student. It ignores ANSI C++ to focus instead on Microsoft's implementation. It contains a number of stylistic problems, relying far too heavily on C instead of the facilities provided by C++. And finally, it only covers techniques any reasonably experienced C++ programmer should already know.
You can purchase Mike and Phani's Essential C++ Techniques from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Comment removed (Score:3, Insightful)
Re:although (Score:2)
Compatibility nightmare (Score:4, Interesting)
For all this trouble, you get a compiler that isn't much improved. It still tells you to call Microsoft customer support at the first non-trivial use of C++. It still doesn't like non-inline template specialization.
Book is from 1999 (Score:5, Informative)
Difference between MS and ANSI? (Score:2)
I'm not a C++ programmer, but I'm very curious to know what the diferences are between ANSI C++ and MS Visual C++.
Re:Difference between MS and ANSI? (Score:2, Insightful)
I assume that the examples use windows-specific libraries and stuff. Like MFC and COM stuff. Or maybe it just discusses the location of various options in the VStudio IDE.
If the book had anything insightful to offer, it really wouldnt matter what flavor implementation the examples are in. I have a really great OpenGL book, for instance, thats full of X-Windows specific examples (like creating and maintaining viewports, etc). Being able to take the ideas to windows is no big thing (cant think of the title of it).
If the book sucks then it sucks because it has nothing to say, not because it uses VC++ as an example. If being VC++ -centric is the only basis for saying it sucks, then the reviewer sucks.
Re:Difference between MS and ANSI? (Score:5, Interesting)
I did try to point out that the book was bad even for Visual C++ programmers. It uses old-style C++ (#include , for example), ignores valuable contributions to C++ such as the STL and the standard string class, and generally provides nothing a decent C++ programmer should not already know.
It isn't so much that the examples are targetted for Visual C++ 6.0, it is that the techniques themselves are. It is no good telling me, 'If you set eax from assembly, disable warning 4035' unless I am using Visual C++ on an ix86-compatible processor. It just doesn't translate to any other platform.
Re:Difference between MS and ANSI? (Score:2)
the string tempaltes are good, but sloooowww as hell.
If you were taught C++ like peeps are taught Java and you've been using std::string in a was that copyies and allocates data all the time then being shown how to use \0 strings will improve you codes memory and speed preformance.
I know people who do C++ 'programming' but wouldn't know how to use structs and function pointers in C to make 'classes'.
Re:Difference between MS and ANSI? (Score:2)
Re:Difference between MS and ANSI? (Score:2)
Come again? functions you don't use have zero effect on the functions you *do* use, except in the overall size of the
Re:Difference between MS and ANSI? (Score:2)
Re:Difference between MS and ANSI? (Score:2)
That said, I can see that for certain cases, although you probably could have gotten most of the same increase by re-working your code instead of switching to C style strings. But whatever works ;)
Re:Difference between MS and ANSI? (Score:3, Informative)
Authors: Michael Hyman and Phani Vaddadi
Publisher: APress [apress.com]
Copyright: 1999
ISBN: 1-893115-04-6
Pages: 300
Now read that "1999" bit again. How, exactly, did "standard" C++ look back about 3.5 years ago?!
What did you expect? Hell, many modern C++ features weren't even implemented by most available compilers in 1999.
Re:Difference between MS and ANSI? (Score:2)
Re:Difference between MS and ANSI? (Score:2)
Pretty much identical to how it looks now, since the standard was published in '98 and the version that became standard was around in '97.
I would hope (not expect, alas) that authors professing to teach C++ would make some vague attempt to do so in a correct and useful way, which this book apparently does not.
And yes, most decent C++ compilers did have reasonable support for the standard bits 'n' pieces by '99. VC++ 6, for example, though featuring a slightly crippled implementation of the standard library, provides perfectly serviceable implementations of string, vector, <iostream>, etc.
Speaking as someone who has helped out on beginners' C++ forums for years, I hate books like this. They typically teach C++ as it was 15 years ago, which is bad enough, and they make out that it's still that way, which is even worse. You only have to look at the average slashbot's response to any thread about C++ (how it doesn't feature garbage collection, is littered with buffer overrun vulnerabilities and memory leaks, etc.) to realise how little most people who think they know actually know. Now, guess why that might be...
Re:1999 Difference between MS and ANSI? (Score:2)
Re:Difference between MS and ANSI? (Score:2)
Not true. MSVC++6 falls far short of the mark WRT compliance to the C++ language definition. Further, there are many features of the VC++ language that simply do not exist in the C++ language (declspec, __int64, all the functions in C headers that start with an underscore, etc).
Re:Difference between MS and ANSI? (Score:2)
VC++ is not a language it is an (seriously broken) implemenation of the C++ language.
The "features" that you mention aren't features as such at all.
declspec is an instruction to the compiler as to what sort of linkage the linker expects, and entirely implemenatation and OS dependent.
__int64 is also an implementation issue; it's a typedef for whatever the particular implementation uses to represent 64 bit integral types. Like declspec, it's meaningless on another implementation or OS or machine architecture.
Functions that start with underscores (like any identifier that starts with an underscore) are according to the standard, "reserved to the implementation"; by definition they're not portable or part of the language per se (even if they exist to implement things specified in the Standard).
The point is, these aren't features; these things are "glue" to attach the language standard to the implementation/OS/machine, or conveneiences. These things aren't in the language because they don't make sense as part of the Standard.
Re:Difference between MS and ANSI? (Score:2)
Yes, you're correct that those features (and they are features -- look up the definition of that word yourself) I mentioned (__int64, extra functions, etc) do not make VC++
Re:Difference between MS and ANSI? (Score:2)
VC++ having them has NOTHING to do with the compiler (they actuall aren't compiler features, they're pre-processor and linker features) and it's implementation of C++. If you're going to say that the VC++ compiler (cl.exe) doesn't implement C++, then you need to either a) give examples of mandatory parts of the language it fails to implement or b) give examples of parts of the language it implements incorrectly. I'm not saying these don't exist. But muttering about declspec doesn't make a damn bit of sense.
Re:Difference between MS and ANSI? (Score:2)
I said that the language implemented by cl.exe is not C++. Even if there weren't conformancy issues (export, templates, main-return-value, the list goes on), then it would be a SUPERSET of C++. As in, JUST BECAUSE IT WORKS IN VC++ DOESN'T MAKE IT C++. Jeez... can you people read?
Re:Difference between MS and ANSI? (Score:2)
Re:Difference between MS and ANSI? (Score:2)
Re:Difference between MS and ANSI? (Score:5, Informative)
It basically means that there are perfectly legal constructs in ANSI C++ that are not allowed in MS Visual C++.
The best example I can name off the top of my head is that something like this is not allowed in MSVC++: And there are things that MS Visual C++ allows by default that it's not supposed to. The most glaring example I can come up with off the top of my head is: As an aside, the Intel compiler is far better.
the for loop thing (Score:2, Informative)
for(int i;...){
}
i=123;
is valid ANSI C (for some strange reason)
for(int i;...){
j
}
j=123;
is not valid
{
for(int i;...){
}
}
i=123;
is not valid
the same is true for if and switch
this is a pain because of reuse.
for(int i;...){
}
for(int i;...){
}
is invalid ANSI C because i is still in scope in the second for loop.
You mean C++ (Score:1)
Re:the for loop thing (Score:2)
for (x; y; z) {code}
into
x; while(y) {code; z;}
which, as it happens, gives declarations in x a wider scope than intended. Also, I don't think that this is ANSI, this is MS specific. The ANSI alternative is
{x; while(y) {code; z;}}
Re:the for loop thing (Score:2)
Re:Difference between MS and ANSI? (Score:2, Informative)
Simon
Re:Difference between MS and ANSI? (Score:2)
Re:Difference between MS and ANSI? (Score:3, Interesting)
0 compile errors on gcc, and like 50 in VS. I found out that where Linux let me to declare the std namespace in the main file where I had all my includes, VS wanted the namespace declared in every file to use anything from the STL. There was also other little stuff, but nothing tooo bad.
I couldn't spend all semester like this, so I picked up a copy of VS. After using it for the rest of the semester, my conclusion was: bleh. It was okay, but nothing to write home about and I missed the command line tools.
Re:Difference between MS and ANSI? (Score:1)
I believe VS 6 was more standard compliant than GCC-2.9x series (GCC 3.x series are even more compliant, but then so is VS
Re:Difference between MS and ANSI? (Score:1)
GCC and 'std' namespace (Score:3)
Let's say it did. Current GCC incarnations honor std namespace conventions way too much according to the always-changing standard, IMHO.
Let me explain and give you an example:
(I'm sorry I had to replace spaces at the beginning of lines by dots or Slashdot's <ecode> would simply eat them..)
This code won't compile. You're required to put an application-supplied utility function in namespace std (remove the comment markers above) or it just won't compile.
That's GCC 3.2 for you. :-( I'm not sure
whether it is to blame because of following strange
standard requirements, but IMHO you should not be
required to put custom functions
into namespace std just to output some data.
I mean: Polluting std namespace because of this?
Any ideas, btw?
Re:GCC and 'std' namespace (Score:2)
#define for if (false); else for (Score:2)
As an aside, where is that famous Intel compiler and what kind of UI toolkits for Windows does it support? I want GNUStep :-(
Re:#define for if (false); else for (Score:2)
Re:Difference between MS and ANSI? (Score:3, Informative)
For years, I have used a simple fix to get around it:
#define for if(false) ; else for
this gives the correct semantics, no matter the usage.
you can't do:
#define for if(true) for
because then the following would not give the intended result
if(x==2) for(...) doSomething();
else doSomethingElse();
(not really clear code, but still valid, and the previous #define example allows it)
Re:Difference between MS and ANSI? (Score:2)
For (no pun intended) any C++ code I write that I'm not sure will only be used on systems that follow the final standard, I use this little trick I found on usenet:
#define for if(false);else for
That makes for loops behave like the standard says, regardless of what scope rules the compiler follows.
Re:Difference between MS and ANSI? (Score:2)
As long as we're pretending this is comp.lang.c++.moderated, while I agree that any op= should return *this, I didn't think the Standard required it.
As my copy of the Standard is at home, and I'm not, could you quote chapter & verse?
For what it's worth, comeau's online compiler [comeaucomputing.com] passes the following:
Re:Difference between MS and ANSI? (Score:2)
Re:Difference between MS and ANSI? (Score:2)
Re:Difference between MS and ANSI? (Score:5, Informative)
On the other hand, there are some problems with the language and libraries if you try to compile code ported from another compliant compiler.
Re:Difference between MS and ANSI? (Score:2)
stdafx.h
#define for if (0) ; else for
weeee
Re:Difference between MS and ANSI? (Score:1)
Ah karma, is there any thing people won't do for you?
Mmmm. Tasty O'Reilly... (Score:1)
More specifics on VC focus (Score:5, Insightful)
Overall, I think his review needs a bit more beef (i.e. more examples) vs just saying "I thought it was blah
Re:More specifics on VC focus (Score:3, Informative)
For instance, if you read the developper's guide from Microsoft and lookup how to bind an event to, say, a button, the devguide will advise you to double-click the button in the dialog editor then use ClassWizard's moronproof dialog boxes, instead of directing you to add a method and a message map entry to your container class...
This IHMO heavily contributes to the fact that many people now can't understand how C++ frameworks work. They're only able to invoke ClassWizard and let it do the job. Of course, there are things ClassWizard cannot do, but in that case... they won't implement the feature at all and whine about "support not present".
Re:More specifics on VC focus (Score:5, Informative)
I initially included examples of how it was bent so completely toward VC++ but it really made the review hard to read.
It is comments such as 'Always use at least warning level 3', with information on how to select it in Visual C++ but without any note that this isn't an ansi-C++ technique, that really annoyed me. The book is littered with techniques that would only work in Visual C++ (and only with Visual C++ 6.0). There are sixteen chapters and I was able to find several examples in pretty much every single chapter. This was all the worse because the book appears to be targetted at ansi-C++.
Bad for most peoples (Score:1)
What goes bad is that peoples like to skip past the boring stuff and try to write advanced code which leads to big maintenance mess.
I only code in C with proven and time tested princilpes and my code is as bullet proof as it gets. So many times you see bad coder write with too many tricks while trying to break the Olog(n) speed barrier and end up with big mess. Don't you be tempted.
Advanced Visual Studio C++? (Score:1, Flamebait)
Visual Studio C++ and advanced programming are mutually exclusive.
All Visual Studio C++ programmers, advance yourselves onto a professional platform with a quality API.
Re:Advanced Visual Studio C++? (Score:1)
Don't you mean "onto a platform with thousands of variable quality APIs for the same thing"?
Simon
Scott Meyers (Score:4, Interesting)
Also, the "C++ In Depth" series (Score:2)
Dr. Stroustrup is the series editor for these books, and damn, they are good. A comment by Kickasso suggests the most excellent Accelerated C++, but it's not just for beginners. (Well, it's targeted for beginners, but it's also an excellent book for experts; it helps to simplify an otherwise complex environment. Kinda like studying Zen.)
Anyhow, that book is part of the In Depth series. They're easy to recognize: all red with yellow titles, and -- an important part -- all small. One of the series' rules is that the main body text must be no more than 300 pages. No more gigantic tomes of crap.
Re:Also, the "C++ In Depth" series (Score:2)
Many (if not all) of the authors are also on the ISO C++ committee. So when they observe that the C++98 language has a particular flaw, you can be sure that they're also finding ways to fix it in C++0x.
Re: Scott Meyers (Score:2)
On some systems, more is already less. [gnu.org]
Kickasso reviews 99.99% of all C++ books at once! (Score:4, Informative)
In the beginners department you can't beat Accelerated C++ [acceleratedcpp.com] by Koenig and Moo. For more advanced programmers there is Scott Meyers.
Re:Kickasso reviews 99.99% of all C++ books at onc (Score:2)
There is a certain amount of truth to this... the C++ standard is really quite complex. I am stunned when I pick up a book like Modern C++ Design and I find a whole new world of C++ opening up for me.
However, let's face it... the reason most learning-C++ books are so bad is because the authors really do not have a clue. For example, there's nothing complicated with teaching a programmer how to use C++-style strings rather than (or in addition to) C-style NULL-terminated strings, yet very few books actually bother.
Pot-kettle scenario (Score:3, Insightful)
I'm probably the last person on earth to jump to Microsoft's defense, but let's not be so quick to deride their compiler prior to pointing out that these deficiencies exist in every C++ compiler under the sun, in one way or another.
Good C++ programmers realize that there is nothing wrong with using C constructs such as null-terminated strings and printf to get the job done. It's obvious the reviewer needs to get a dose of programming in the real world before attempting to set himself (herself?) up as some sort of C++ expert.
GCC 2.9x? (Score:1)
Re:Pot-kettle scenario (Score:3, Informative)
I would hardly say there is nothing wrong with using C constructs such as null-terminated strings and printf(). I would agree that there are many times that you do want to use such constructs, however, and I often do in my code. However, a book targetted to C++ programmers should use C++ constructs where appropriate. Use a null-terminated string if there's a good reason for it, of course, but otherwise, why not use the C++ string? And why, for God's sake, have a whole appendix on implementing your own string class in C++? It seemed to offer far less than the standard string class and didn't provide any advantages. I can see examining a class like this if you are trying to learn C++ and want a better understanding, but for an advanced C++ programmer?
Re:Pot-kettle scenario (Score:2)
True, GCC is not 100% ISO compliant, but it's really not fair to bring up stuff about 2.9x. 2.95 was released almost five years ago, and 3.0 (its much more compliant successor) was released almost three years ago, with the even more compliant 3.1 (aka 3.2) being almost two years old.
Re:Pot-kettle scenario (Score:2)
Re:Pot-kettle scenario (Score:2)
You mean imacat writing
talking about VC++.NET, or antity's response of
?
In any case, who cares what people are ragging on? The complaining about GCC 2.95's standard compliance is absurd, whether or not any other complaints are absurd.
Re:Pot-kettle scenario (Score:3, Informative)
I think the EDG frontend is pretty much there these days. I don't doubt it still has the odd bug, but they do now have an implementation of "export", which has been the real ball-and-chain attached to the leg of any team attempting to hit full compliance. The Comeau compiler (www.comeaucomputing.com) uses this frontend.
Every indication is that the upcoming 7.1 release of the MS C++ compiler will be very good indeed; possibly better than G++. Their attitude to ANSI has really come on in leaps and bounds; I've heard from several sources that even the alpha could build Loki, Boost and Blitz without hacks. Loki in particular is notorious for killing compilers; it is to C++ what TeX was to Pascal.
> Good C++ programmers realize that there is nothing wrong with using C constructs such as null-terminated strings and printf
For quick hacks, sure. For big, critical production systems, I'd say that using printf is verging on professional negligence in this day and age.
> It's obvious the reviewer needs to get a dose of programming in the real world
Now you're just trolling.
Re:Pot-kettle scenario (Score:2)
DATA\0
There are also prefix-strings
with DATA or strings with both prefix and termination.
C++ strings are simply object-wrapped versions of either of those types of strings, is not that correct?
Were you expecting time-travel? (Score:3)
God bless slashdot. Anytime I need a good dose of revisionist history, I know where to look.
The library for 2.x (the part responsible for streams) predates the ANSI/ISO standard. It's full of "this is our best guess at what will eventually be voted on, based on the last meeting" code.
When the standard was finalized and published, the 2.x library was dropped, and a new one started from scratch. When GCC 2.x was shipped, its library was already known to be wrong, but stable and "mostly good enough". And the new one was already in the works.
For that matter, large chunks of the 2.x compiler itself had been abandoned for 2.x, knowing that it would be better to rewrite it for 3.x completely.
Boggles my mind why people expect a four-year old product to conform to a four-year old standard. (Hint: it takes a while after the standard is published to write the code.)
Weak book? (Score:2)
MSVC6 kicks out a warning if you do this. No programmer worth their salt ignores warnings: as a MSVC programmer, at least put a pragma around issues to disable unwanted warnings!
Personally, I've never had a problem with the APIs when developing cross-platform code implemented in ANSI C++ under MSVC6. The MSDN documentation is normally very good about declaring compatibility levels for the libraries. The biggest gotcha that's burnt me with ANSI C++ under MSVC6 was to do with 1) scope of variables in if statements; and 2) exception decoration on function/method declarations.
Plug (Score:3, Interesting)
About a half year ago i was doing some C++ programming, which i haven't been doing as much as of as i'd like to, and I had an idea. It seemed each time I started programming something in C++, I would have forgotten some of the details of the language. I wanted a reference card for C++. I searched all over the internet for free ones, and even some I had to pay for. but there weren't any!
So i wrote one. It includes all the common syntax, plus a lot of advanced reference such as library functions.
gbook.org/refcard [gbook.org]
This post is going to get modded down, but I wanted to say how much I like the concept of a one sheet reference card better than reference books.
Moderator bait - Re:Plug (Score:1)
This bugs me when people include comments about being moderated down. Have some confidence in what you're writing. Comments like this often come across as way to *avoid* being moderated down. Personally I do not see why your comment would be moderated below one - there's nothing particularly offensive about it, and it might be of interest to some people. OTOH, if I had some mod points left, I wouldn't mod it up beyond three, although I might mod it over-rated and back down to one just for the commented I quoted above
Dude. (Score:2, Informative)
For MSVC development (Score:4, Interesting)
no... codeProject (Score:2)
-c
Top 5 reasons to buy a crappy C++ book (Score:1, Redundant)
5 -- You won't read it anyway
4 -- It comes out of your company's wallet, not yours
3 -- It's the only language left that doesn't try to be "write once, run on any toaster oven"
2 -- You still can't figure out how pointers work
1 -- It's still less crappy than the writing on Slashdot
Another joke courtesy of *nix.org [starnix.org]
Re:Top 5 reasons to buy a crappy C++ book (Score:2)
And yet, ironically enough, it's one of the few where this is not far from the truth. :-)
To late. (Score:1)
I saw it for $5.99 on the discout rack...
I'd say you get what you pay for, but I got a lot of good O'reilly for $5.99 off the discout rack.
Re:To late. (Score:2)
Re:To late. (Score:1)
Nitpick (Score:2)
What was I thinking ^&%#^%@ (Score:2)
Re:Nitpick (Score:2)
I take it you mean STL strings? Apart from those, I cannot imagine what you mean by standard C++ strings.
I suppose he means std::string as defined in the C++ Standard ISO/IEC 14882:1998
If that is what you mean, I have to point out that STL strings are no more 'standard' than the null terminated variety.
NUL-terminated strings are also Standard C++
From the review I would hazard a guess that the book makes no reference to the Standard Template Library
Neither does the standard. STL has been assimilated.
Re:Nitpick (Score:2)
Re:Nitpick (Score:2)
More or less. If you want the actual story, do a search for Stepanov, but basically the STL as a concept was invented completely independently of C++, it happened that C++ was the first decent language they found to implement those concepts, and given the match and some advocacy by a few C++ notables, much of the standard C++ library is based on the ideas of the STL.
worst book review ever (Score:4, Interesting)
There are dozens of books that are more than suitable for the reviewer and his expectations. When the reviewer fails to properly identify the book's audience and it's value to that audience, they aren't doing anyone any favors. What kind of review do you think a romance novelist would give to Stroustrop's C++ book? They obviously aren't the audience the author intended and as a result, their review isn't worth the paper they wrote it on. If you get a book and find that you aren't in the intended audience, you are doing a severe injustice by providing a review. You won't be able to fully ascertain how useful the book actually is and thus won't be able to provide an insightful review. I don't ask my wife for her opinion on programming books and she doesn't ask for my opinion when it comes to interior decorating. In the same vein, I don't want Chris Thompson's opinion on this book.
MOD PARENT UP (Score:2)
Re:worst book review ever (Score:2)
It could well be the worst book review ever. I hope not, but hey, everyone's intitled to their opinion.
I will point out, however, that I use Visual C++ every day. I have no particular problems with Visual C++ (well, I'd like partial template specialisation but hey). However, I'll remind you, as I pointed out in my review, even examining the index and the introduction of this book does not tell you this is targetted only at Visual C++ 6.0 programmers. Many book stores won't let you read 20 or 30 pages before you buy it.
Furthermore, even for the book's real targetted audience (Visual C++ 6.0 beginning programmers), the book is bad. The book lists numerous code samples which are simply bad programming style. I mention this in the review as well.
Yes, I was annoyed that the book mislead (my initial choice of words was much harsher) its purchasers about the real target audience. But the book itself is still really bad even ignoring this significant flaw.
Re:worst book review ever (Score:2)
Re: worst book review ever (Score:2)
Re:Bright Spots? (Score:4, Informative)
Re:Bright Spots? (Score:1)
Re:Bright Spots? (Score:2)
Try C++ Templates by Josuttis and Vandevoorde. Good stuff.
Re:Bright Spots? (Score:2)
Oh yeah. That is one book that separates the C++ hard-core hackers from the wannabes.
The hard-code programmer will read that book and smile.
The wannabe will run away, crying for mother.
Best US$40 I spent recently. If you're serious about advanced C++ (and I don't use the word advanced lightly -- templates form much of the foundation of what he does, and, are not represented as an "advanced" technique in and of themselves, for example), I recommend it highly. The introductory section on "Techniques" alone is worth the price of the book -- it will leave you smacking your head thinking, "What a cool language hack!"
As an appetizer, his discussion of type traits helps answer the age old question of what to do when you need to abstract semantics, and/or deal with the fact that you have a particularly efficient implementation of a given interface for restricted semantics on a given platform, and still want to write portable code that accomodates it.
I hear that compilers secretly refer to Alexandrescu as the Marquis de Sade.
Re:Bright Spots? (Score:2)
Re:Bright Spots? (Score:2)
Well, duh! Nothing other than copious parenthesis will satisfy a Lithper so far gone as ye :-)
Re:Not so great (Score:1, Informative)
http://www.accu.org/bookreviews/public/reviews/
Re:Not so great (Score:2)
Is that the entire quote, or did you forget to add the quote?
And what's the CRT (in this context)? Surely not Cathodae Ray Tube?
Aside: I assume your distate for the 'after' example is the public member variables, the use of char* and float as opposed to std::string and double, the non-initialization of the pointer member, and that the ctor doesn't actually set up the object's state? Oh, and the Hungarian notation. And the "C-ism" of attaching the pointer decorator to the variable name, rather than to the type. Or an I missing other problems with it?
Re:Not so great (Score:2)
I didn't write the comment you are responding to. However, here is the complete text from that section. I think it is a good example of how this book is not targetted at ANSI-C++ programmers.
Re:Not so great (Score:2)
This always annoys me...
char* x, y; - what is y?
char *x, y; - ah, now we see what y is.
Cheers,
Ian
Re:Not so great (Score:1)
char* x, y; - what is y?
char *x, y; - ah, now we see what y is.
As a general rule, I don't mix "pointer-to-sometype" variable declarations with "sometype" declarations, because they only save keystrokes at the expense of potential confusion. For the above code, it is probably best to separate the declarations of x and y.
char * x;
char y;
I admit that this is a relatively minor issue that doesn't greatly influence the overall readability of code.
Re:Not so great (Score:3, Informative)
This all matters particularly in C++ because, unlike in C89, the definitions are mixed in with other statements. C99 allows the mixing, and you may expect to see similar rules surface for C99.