Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Can anybody recommend a C++ book? (intermediate/advanced)

Reply
Thread Tools

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

 
 
jklimek@gmail.com
Guest
Posts: n/a
 
      09-21-2006
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!

 
Reply With Quote
 
 
 
 
red floyd
Guest
Posts: n/a
 
      09-21-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) 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.

 
Reply With Quote
 
 
 
 
tragomaskhalos
Guest
Posts: n/a
 
      09-21-2006
(E-Mail Removed) 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

 
Reply With Quote
 
mlimber
Guest
Posts: n/a
 
      09-21-2006
tragomaskhalos wrote:
> (E-Mail Removed) 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-lit...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

 
Reply With Quote
 
Noah Roberts
Guest
Posts: n/a
 
      09-21-2006

tragomaskhalos wrote:
> (E-Mail Removed) 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.

 
Reply With Quote
 
Noah Roberts
Guest
Posts: n/a
 
      09-21-2006

(E-Mail Removed) wrote:

> So can anybody recommend me a C++ book?


http://www.bookpool.com/sm/0201775816

 
Reply With Quote
 
tragomaskhalos
Guest
Posts: n/a
 
      09-21-2006

Noah Roberts wrote:
> tragomaskhalos wrote:
> > (E-Mail Removed) 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";.

 
Reply With Quote
 
mlimber
Guest
Posts: n/a
 
      09-21-2006
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

 
Reply With Quote
 
Jack G. Atkinson Jr
Guest
Posts: n/a
 
      09-22-2006
Just about anything written by Scott Meyers.

Effective C++
Effective STL
More Effective C++

My two cents!


(E-Mail Removed) 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.
(E-Mail Removed)
Psa 104:4 He makes His angels spirits,
His ministers a flaming fire.
Luke 12:36-47 - Be ready!
------------------------------------------------------------------
 
Reply With Quote
 
mlimber
Guest
Posts: n/a
 
      09-22-2006
Jack G. Atkinson Jr wrote:
> Just about anything written by Scott Meyers.
>
> Effective C++
> Effective STL
> More Effective C++


Sure. As the FAQ suggests, buy at least three:

http://www.parashift.com/c++-faq-lit....html#faq-28.4

Cheers! --M

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can anybody recommend a good 24" monitor? Wally Digital Photography 18 07-11-2010 02:24 AM
Can anybody recommend...... hawklord Digital Photography 7 03-03-2006 03:13 PM
Examblaster software - Can anybody recommend it? Alex Walker MCSE 0 02-07-2005 10:47 AM
Hey Tigers! Anybody recommend the best firewall? James Computer Support 4 02-03-2005 05:36 AM
OT. Can anybody recommend a newsgroup or another place to post original music? Jersey Computer Support 5 06-26-2004 07:29 PM



Advertisments