Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have this big book that basically covers all the main aspects of the C++, the problem is that is pretty old according to the C++ standards of today, it's ok to use it?

share|improve this question
3  
Far more important than which language it uses as baseline is whether it teaches using that language in ways that are now considered good. Writing "C/C++11" is worse than writing "Modern C++98". –  delnan Jun 29 '12 at 22:08
5  
It'd probably help if you named the actual book. –  Caleb Jun 29 '12 at 22:23
1  
@Caleb it's an italian book from a university professor, i do not think you know, anyway this is the book and the main topics are C++ and UML. –  user827992 Jun 29 '12 at 23:12
1  
@delan C/C++ isn't a language, and C/C++11 definitely isn't a language. There is language that is called C and there is a language called C++ which in most cases is a superset of C, but not in all cases. They are two different languages. Saying C/C++ is like saying Java/C#. –  Jarrod Roberson Jun 29 '12 at 23:25
1  
@JarrodRoberson: You missed delnan's point. Of course there is a language C/C++ aka C with classes and there is another language Modern C++. –  Benjamin Bannier Jun 29 '12 at 23:47
show 5 more comments

5 Answers

up vote 6 down vote accepted

It's fine to use it. You won't get the most up-to-the-minute information, but the large majority of C++ is the same language that it was in 1998. If you're just learning the basics, go right ahead. Just keep in mind that there have been some refinements, and look for resources that explain the differences so that you're aware of them.

Here are a few of those resources:

share|improve this answer
1  
Not to mention that not every development shop is using the most recent compiler stack on their platform, so by sticking to "old" patterns you can work on a larger number of codebases and environments. –  Jason Scheirer Jun 29 '12 at 22:02
3  
That's not true at all. C++11 is a major gamechanger in many areas. –  DeadMG Jun 29 '12 at 22:11
2  
@DeadMG I'm not saying that the differences aren't important, but to someone just learning C++, there's plenty to learn that stays the same. Stroustrup himself wrote that although he's working on a 4th edition of his book, "...it is important that The C++ Programming Language (3rd Edition) describes Standard C++, its standard library, and the techniques they support... It is not suddenly going to be outdated. The billions of lines of C++ will still mostly be C++98 and will still work with C++11 compilers." –  Caleb Jun 29 '12 at 22:22
2  
@LokiAstari The OP said his book covers the C++98 standard, and that certainly includes exceptions. Stroustrup's The C++ Programming Language, 3rd ed. was published in '97 but includes both exceptions and the STL. I'm dubious that "most" books on C++98 don't cover those things -- I have a few books from that era and all cover both. –  Caleb Jun 30 '12 at 0:10
1  
If the learning is to learn the syntax, go ahead, with caution, the syntax is substantially the same with notable exceptions compared to C++11 easy to find and relatively small. I am in the boat of wanting to re-learn C++ after about 18 years away from it. As I see it, C++ today is syntactically the same (To practical purposes), C++11 a little different, But I have to learn to write "C++11 programs", not "C with Classes C++" or "C++ circa 2000" –  mattnz Jun 30 '12 at 0:46
show 2 more comments

C++11 is a pretty big deal- not to mention that many books back in 98 taught C with Classes, rather than C++. I'd look for something newer. We have a question on Stack Overflow which supplies recommendations for books worth possessing.

Edit: Of course, there are also many new C++ techniques which simply did not exist previously, especially where templates are concerned, and there are some idioms which are no longer, like checking for self-assignment, not to mention global changes in the software industry like pushes for parallelism.

share|improve this answer
3  
That's the question stackoverflow.com/questions/388242/… –  Florents Tselai Jun 29 '12 at 22:50
    
Note that the OP never actually said that the book is from 1998 - only that it is about the 98 version of the language. –  sepp2k Jun 30 '12 at 11:06
1  
@sepp2k - The advice is the same. The C98 specification is outdated. It is fine if that is what you need to use, but if you have a choice, learn the current specification and the differences between them. –  Ramhound Jul 5 '12 at 13:49
    
@DeadMG Is checking for self assignment universally gone? Why? –  Dave Jul 5 '12 at 23:48
    
@Dave: Because self-assignment is actually insanely rare, but you pay the cost of the check. Copying or moving the object on the rare scenario when you do self-assign is less cost overall. –  DeadMG Jul 8 '12 at 13:46
add comment

It's probably better to learn the old version first:

  • It may be a while before C++11 is fully supported by the latest version of your favorite compiler. Or the compiler your particular project requires you to use.
  • Code written before C++11 won't use it. It may be a while (as in, "possibly never") before any given project migrates to C++11.
  • In order to understand the reasoning behind the design of C++11, it is probably best to understand the original form of the language.

At any rate, if you don't learn the old version first, you may have a hard time figuring out how to write for any system that doesn't fully support the new one. For that matter, I would recommend learning C first, before learning the old version of C++: it will save you many agonizing moments of "why the hell did they do it like that?"

share|improve this answer
    
+1 All good points. –  Caleb Jun 29 '12 at 23:02
2  
-1 - why the recommendation to learn C? the question only mentions c++ –  ell Jun 29 '12 at 23:15
    
actually nevermind, I see you said so you don't question the reason. Although I disagree I don't think it warrants a downvote, removed. edit: sorry can't remove it now –  ell Jun 29 '12 at 23:25
3  
Yes it may be worth learning C++03. But it is definitively not worth learning C++98 (that is dead). Even books written in the early 2000's are going to be pretty horrible for learning C++03 from as the way the language is used has drastically changed. I would recommend not learning C as a stepping stone to learn C++ (learn it as its own language) but it apart from the underlying basic syntax they have nothing in common. What is good practice in C may not be good practice in C++. –  Loki Astari Jun 29 '12 at 23:54
add comment

I am going to advocate learning C++11, not older versions. It's true that the large majority of the language syntax and semantics will be the same and it's true that there's virtually no C++ 11 codebases in the roughly gazillion lines out in the wild. So, yes, it's true that you're essentially learning a new and not-yet-common dialect and that may be a disadvantage if you are quickly charged with doing something with an older dialect.

But the new dialect is better and simpler. The problem, I think, is that when you do go and deal with an older codebase, you may be confused by "Why didn't they just use...?" thoughts. But the flipside is that if you learn an old dialect, as a beginner you are poorly prepared to know "Oh, okay, this template thing is replaced by a much simpler lambda thing..." and you can find yourself dealing with some really hairy-looking code.

It's true that compiler support is still patchy, but I think everyone has auto and lambdas and range-based for and support shared_ptr/unique_ptr/weak_ptr. So there's a lot of really big wins that are widely available.

(It's true, though, that if you're just using a book, you probably won't be exposed to the full glorious melange of idioms you see in a legacy codebase.)

share|improve this answer
add comment

The book itself isn't bad, but it is not a "language" book, but much more a "software engineering book".

It should not be used to learn a "language" but to learn "design techniques". The language is just a tool to implement the samples.

That said, we have to consider that in '98 C++ had a flawed template support and that many techniques where not been discovered/invented yet.

You must hence be conscious about some potential risks:

  1. The author don't speach about a technique because not yet available. This is information incompleteness, you can fill-up with a further read. Not bad by itself... but why not start with a more recent reading?
  2. The author is not (yet) aware of a potential problem a technique is teaching may have (because it has been discovered later). A bit more dangerous: if you don't fill this gap, you may be in troubles other are already away from.
  3. The author is aware of certain problems and teach you techniques to avoid/solve them. May be now there are more effective/proper ways to avoid/solve those problems, making those techniques unnecessary overhead.

Moral: when talking about C++, books that predate 2003 should not be anymore considered.

share|improve this answer
    
can you give me some good title? Which version of the standard you can consider a good starting point? –  user827992 Jul 5 '12 at 10:37
    
There is a question on SO that covers suggestions on C++ books. –  Ramhound Jul 5 '12 at 13:52
    
I have to disagree about the date. Alexandrescu's Modern C++ Design from 2001 is considered the definitive book on template-metaprogramming. Of course, when it was written, most compilers didn't even support templates well enough to use everything in it. –  Dirk Holsopple Oct 16 '12 at 13:01
    
@DirkHolsopple: One of the things I've leaned in 30+ more year of experience is "never use the word "definitive". Andrei's work was truly the predecessor of template metaprogramming. It is certaily good about the concepts, but it requires a review about the samples, at least because C++11 syntax can greatly simplify many of them (He make a lot of mortal-jumps to allow varadic template surrogates not anymore necessary, for example!). The point is to be aware of it. You can study Andrei's techniques, of course, but I would not recommend them as today's best practices... –  Emilio Garavaglia Oct 17 '12 at 8:12
    
... Although it is certainly true that many of today's best practices derives from Andrei's studies and publications –  Emilio Garavaglia Oct 17 '12 at 8:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.