Can anybody recommend a C++ book? (intermediate/advanced)

Discussion in 'C++' started by jklimek@gmail.com, Sep 21, 2006.

  1. Guest

    I'm currently a Delphi developer (my day job) but at my company we only
    write custom web application/database stuff, so we never really get
    into anything advanced. However, I know enough about pointers, objects,
    etc, to consider myself an "intermediate" level programmer.

    Well, I'm looking to write a game involving physics and multiplayer
    capability, and that pretty much means I need C++ if I want to use any
    existing engines (eg. HGE, RakNet, ODE, etc).

    With that said, I know enough about C++ to write basic programs and I
    can even write simple objects but thats about it. When it comes to
    multiple inheritance, templates, advanced memory allocation, advanced
    pointers, and other advanced C++ stuff I'm pretty lost.

    So can anybody recommend me a C++ book?

    What concepts are important to learn for writing a multiplayer game in
    C++?

    Any suggestions available on Safari (www.safaribooksonline.com) is a
    bonus Smile

    Thanks in advance for any suggestions!
    , Sep 21, 2006
    #1
    1. Advertising

  2. red floyd Guest

    wrote:
    >
    > So can anybody recommend me a C++ book?
    >
    > What concepts are important to learn for writing a multiplayer game in
    > C++?
    >
    > Any suggestions available on Safari (www.safaribooksonline.com) is a
    > bonus Smile
    >


    I don't know if its available on Safari, but I'd start with Koenig & Moo
    "Accelerated C++". It starts you off the "C++ way", rather than as C
    and then adding the classes.
    red floyd, Sep 21, 2006
    #2
    1. Advertising

  3. wrote:
    > [snip]
    > With that said, I know enough about C++ to write basic programs and I
    > can even write simple objects but thats about it. When it comes to
    > multiple inheritance, templates, advanced memory allocation, advanced
    > pointers, and other advanced C++ stuff I'm pretty lost.


    No book recommendation but ....
    C++ is a big language, but don't fall into the trap of thinking that
    you need to know every nuance and corner of it to do productive work.
    Eg for templates you probably need to know enough to use the STL but
    you don't need to worry about writing your own templates until you've
    found your feet a bit. In fact I'd tackle your list thus:
    MI - you won't need it.
    Templates - see blurb above.
    Advanced memory allocation - new and delete, possibly auto_ptr, that's
    all. Don't go near writing your own operator new, allocators or any of
    that.
    Advanced pointers - You'll read lots on this ng about various smart
    pointers, but again I'd suggest sticking with raw pointers for
    starters.

    When you pare down the list like this it all becomes a lot less
    daunting - if you know Delphi and have a good intuitive grasp of what a
    pointer is then you have a good starting point.

    HTH
    tragomaskhalos, Sep 21, 2006
    #3
  4. mlimber Guest

    tragomaskhalos wrote:
    > wrote:
    > > [snip]
    > > With that said, I know enough about C++ to write basic programs and I
    > > can even write simple objects but thats about it. When it comes to
    > > multiple inheritance, templates, advanced memory allocation, advanced
    > > pointers, and other advanced C++ stuff I'm pretty lost.

    >
    > No book recommendation but ....


    Since the OP asked, see accu.org for lots of book reviews. But
    _Accelerated C++_ is probably the single best book out there for
    learning (or re-learning or expanding one's knowledge of) C++ the right
    way.

    > C++ is a big language, but don't fall into the trap of thinking that
    > you need to know every nuance and corner of it to do productive work.
    > Eg for templates you probably need to know enough to use the STL but
    > you don't need to worry about writing your own templates until you've
    > found your feet a bit. In fact I'd tackle your list thus:
    > MI - you won't need it.
    > Templates - see blurb above.
    > Advanced memory allocation - new and delete, possibly auto_ptr, that's
    > all. Don't go near writing your own operator new, allocators or any of
    > that.


    Add to that STL containers (cf.
    http://www.parashift.com/c -faq-lite/containers.html#faq-34.1).

    > Advanced pointers - You'll read lots on this ng about various smart
    > pointers, but again I'd suggest sticking with raw pointers for
    > starters.


    I'd suggest just the opposite. Use raw pointers only when you must
    (which is usually when you are communicating with a third-party
    library). Unlike raw pointers, smart pointers (and other containers
    that replace them like std::vector and std::string) are exception-safe
    and provide automatic clean-up, which can virtually eliminate memory
    leaks. To top it off, a very high quality and well-tested
    implementation of several such classes is available for free from
    boost.org, and in fact Boost's shared_ptr is part of TR1, which means
    it will in all likelihood be an official part of the standard library
    at the next revision.

    Cheers! --M
    mlimber, Sep 21, 2006
    #4
  5. Noah Roberts Guest

    tragomaskhalos wrote:
    > wrote:
    >
    > Eg for templates you probably need to know enough to use the STL but
    > you don't need to worry about writing your own templates until you've
    > found your feet a bit. In fact I'd tackle your list thus:
    > MI - you won't need it.


    Since C++ does not have a concept of interfaces besides abstract
    classes that you inherit from you need MI in *many* normal situations.
    There are many cases when you just can't write clean code without it,
    you have to sacrifice some form of design to work around not using MI,
    and this is just silly. MI isn't very complex anyway, I don't know why
    you would want to remove it from a list of things to learn.

    > Templates - see blurb above.


    Well, I put templates on a bit higher priority but in general you're
    right.

    > Advanced memory allocation - new and delete, possibly auto_ptr, that's
    > all. Don't go near writing your own operator new, allocators or any of
    > that.


    Yep, the default usually works pretty good.

    > Advanced pointers - You'll read lots on this ng about various smart
    > pointers, but again I'd suggest sticking with raw pointers for
    > starters.


    Since smart pointers are a lot easier and safer to use I would say
    "advanced pointers" are the raw kind. I wouldn't try to write a smart
    pointer right away because it requires an advanced level of knowledge
    but definately use them.
    Noah Roberts, Sep 21, 2006
    #5
  6. Noah Roberts Guest

    Noah Roberts, Sep 21, 2006
    #6
  7. Noah Roberts wrote:
    > tragomaskhalos wrote:
    > > wrote:
    > >
    > > MI - you won't need it.

    >
    > Since C++ does not have a concept of interfaces besides abstract
    > classes that you inherit from you need MI in *many* normal situations.
    > There are many cases when you just can't write clean code without it,
    > you have to sacrifice some form of design to work around not using MI,
    > and this is just silly. MI isn't very complex anyway, I don't know why
    > you would want to remove it from a list of things to learn.


    Fair enough - I was going to point out that MI isn't actually very
    hard, but my original comment was based on the observation that MI
    isn't available in a lot of languages (including C++ once upon a time)
    and they seem to do OK, albeit that some of them do provide interfaces
    instead. So I'm not convinced that you can't get away without it, but
    would agree that it's conceptually so straightforward that there's no
    real value in *not* learning it early on.

    >
    > > Advanced pointers - You'll read lots on this ng about various smart
    > > pointers, but again I'd suggest sticking with raw pointers for
    > > starters.

    >
    > Since smart pointers are a lot easier and safer to use I would say
    > "advanced pointers" are the raw kind. I wouldn't try to write a smart
    > pointer right away because it requires an advanced level of knowledge
    > but definately use them.


    You and mlimber have both picked me up on this, and I suspect you both
    represent the majority expert view so I appreciate I'm on thin ground
    here. But my personal preference is to learn the raw concept first (eg
    traditional pointers), get to know first hand the challenges involved
    (eg ohmygawd I have to keep on top of all these deletion / ownership
    issues), and then move onto an abstraction (ie smart pointers) that
    saves a lot of grief, when one can appreciate fully the value of it.
    The danger as I see it of going straight to the abstraction is that you
    can be left without the underlying understanding when something doesn't
    work as you'd expect (eg there was a thread a few days ago about
    circular references with shared_ptr). Joel Spolsky expresses this far
    more eloquently when he talks about "the law of leaky abstractions",
    which abound in C++ partly because of all the legacy baggage of C
    compatibility; he gives the example of std::string, which works
    brilliantly at hiding the novice from some ugly realities until they
    try and do string s = "oh" + "oh";.
    tragomaskhalos, Sep 21, 2006
    #7
  8. mlimber Guest

    tragomaskhalos wrote:
    > Noah Roberts wrote:
    > > tragomaskhalos wrote:
    > > > Advanced pointers - You'll read lots on this ng about various smart
    > > > pointers, but again I'd suggest sticking with raw pointers for
    > > > starters.

    > >
    > > Since smart pointers are a lot easier and safer to use I would say
    > > "advanced pointers" are the raw kind. I wouldn't try to write a smart
    > > pointer right away because it requires an advanced level of knowledge
    > > but definately use them.

    >
    > You and mlimber have both picked me up on this, and I suspect you both
    > represent the majority expert view so I appreciate I'm on thin ground
    > here. But my personal preference is to learn the raw concept first (eg
    > traditional pointers), get to know first hand the challenges involved
    > (eg ohmygawd I have to keep on top of all these deletion / ownership
    > issues), and then move onto an abstraction (ie smart pointers) that
    > saves a lot of grief, when one can appreciate fully the value of it.
    > The danger as I see it of going straight to the abstraction is that you
    > can be left without the underlying understanding when something doesn't
    > work as you'd expect (eg there was a thread a few days ago about
    > circular references with shared_ptr).


    Can't the same thing be said for any abstraction, e.g. compilers. Why
    use C++ instead of assembly since it only hides the details of how
    things actually work? We deal in the abstract because it helps us solve
    problems more easily. Granted that it is helpful to know how to use the
    lower level elements as well, but that doesn't mean one should *start*
    there. _Accelerated C++_ doesn't -- the authors introduce std::vectors
    and std::strings first and only in chapter 9 or 10 get to raw pointers
    and arrays.

    > Joel Spolsky expresses this far
    > more eloquently when he talks about "the law of leaky abstractions",
    > which abound in C++ partly because of all the legacy baggage of C
    > compatibility; he gives the example of std::string, which works
    > brilliantly at hiding the novice from some ugly realities until they
    > try and do string s = "oh" + "oh";.


    Sure, but one can (and should!) still use these imperfect abstractions
    to great effect.

    Cheers! --M
    mlimber, Sep 21, 2006
    #8
  9. Just about anything written by Scott Meyers.

    Effective C++
    Effective STL
    More Effective C++

    My two cents!


    wrote:
    > I'm currently a Delphi developer (my day job) but at my company we only
    > write custom web application/database stuff, so we never really get
    > into anything advanced. However, I know enough about pointers, objects,
    > etc, to consider myself an "intermediate" level programmer.
    >
    > Well, I'm looking to write a game involving physics and multiplayer
    > capability, and that pretty much means I need C++ if I want to use any
    > existing engines (eg. HGE, RakNet, ODE, etc).
    >
    > With that said, I know enough about C++ to write basic programs and I
    > can even write simple objects but thats about it. When it comes to
    > multiple inheritance, templates, advanced memory allocation, advanced
    > pointers, and other advanced C++ stuff I'm pretty lost.
    >
    > So can anybody recommend me a C++ book?
    >
    > What concepts are important to learn for writing a multiplayer game in
    > C++?
    >
    > Any suggestions available on Safari (www.safaribooksonline.com) is a
    > bonus Smile
    >
    > Thanks in advance for any suggestions!
    >



    --
    ------------------------------------------------------------------
    Jack G. Atkinson Jr.

    Psa 104:4 He makes His angels spirits,
    His ministers a flaming fire.
    Luke 12:36-47 - Be ready!
    ------------------------------------------------------------------
    Jack G. Atkinson Jr, Sep 22, 2006
    #9
  10. mlimber Guest

    mlimber, Sep 22, 2006
    #10
  11. Noah Roberts Guest

    Jack G. Atkinson Jr wrote:
    > Just about anything written by Scott Meyers.
    >
    > Effective C++
    > Effective STL
    > More Effective C++
    >
    > My two cents!


    Why top post?

    Personally I think Sutter's books are better.
    Noah Roberts, Sep 22, 2006
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dustin Price

    Good Intermediate/Advanced Java book

    Dustin Price, Dec 22, 2005, in forum: Java
    Replies:
    5
    Views:
    2,835
    Dustin Price
    Dec 22, 2005
  2. Arnold
    Replies:
    0
    Views:
    400
    Arnold
    Oct 29, 2003
  3. steven acer

    recommend an advanced java book

    steven acer, Dec 20, 2006, in forum: Java
    Replies:
    3
    Views:
    381
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Dec 24, 2006
  4. Michele Simionato
    Replies:
    1
    Views:
    595
    Lacrima
    Mar 27, 2010
  5. mr_burns
    Replies:
    1
    Views:
    122
    Robert
    Jan 8, 2005
Loading...

Share This Page