Link to home
Start Free TrialLog in
Avatar of curmudgeon42
curmudgeon42

asked on

C++ - How to further self-education...

I am trying to teach myself C++.  I have experience with like a dozen other languages, but C++ is by far the most complex and the closest to the machine that I have ever tried to learn.

I know PHP, VB (6 and .NET), ColdFusion, JavaScript, a dabbling of Java, Perl, ASP, and a bunch of other stuff.

I have read this book on C++:
http://www.amazon.com/exec/obidos/tg/detail/-/1576760634/qid=1045626723/sr=1-1/ref=sr_1_1/102-0171348-9453700?v=glance&s=books

It was a decent book.  And I understood most of it.  My question: how should I proceed in C++?  I feel that I know a lot about the syntax and capabilities of the language.  But I couldn't make a GUI program (in Windows or anything else).  What are people doing nowadays with C++?  Should I move on to C++ .NET, or is that a doomed thing?  What books should I read?  What websites should I go to?

I know this isn't usually the sort of question that gets posted here.  But there is a lot of expertise here and I would like to try to attain that level as well. :-)

Thanks,

Justin Kohlhepp
justin@coffeegeek.net
Avatar of Exceter
Exceter
Flag of United States of America image

>> and the closest to the machine that I have ever tried to learn.

Keep in mind, this is still a high level language. :-)

Exceter
Avatar of curmudgeon42
curmudgeon42

ASKER

Yes but in every other language I've learned I've never once had to be concerned with whether a variable was a value or a memory address of a value (i.e. a pointer) and arrays are just pointers that don't do bounds checking and strings don't exist they are just char arrays that are passed around as pointers and ... well you see my point

Don't get me wrong, I can see that the language is extremely flexible and powerful.  I'm just a bit overwhelmed and don't know what to do next.
Yes but in every other language I've learned I've never once had to be concerned with whether a variable was a value or a memory address of a value (i.e. a pointer) and arrays are just pointers that don't do bounds checking and strings don't exist they are just char arrays that are passed around as pointers and ... well you see my point

Don't get me wrong, I can see that the language is extremely flexible and powerful.  I'm just a bit overwhelmed and don't know what to do next.
> "Yes but in every other language I've learned I've never once had to be concerned with whether a variable was a value or a memory address of a value (i.e. a pointer) and arrays are just pointers that don't do bounds checking and strings don't exist they are just char arrays that are passed around as pointers and ... well you see my point"

from this description, i can easily say that the book you had is a terrible one.  things like char arrays, dynamic arrays which are nothing but pointers, a lot of pointer stuff, etc. is *not* c++; that's c.  sure, c++ includes c and thus you should know about them but it is not encouraged to use those features unless you are absolutely required to do ( and, two common reasons for that is, performance or a need to work with a legacy c api )

when you are writing true c++, pointers have much less use and even then there are smart pointers.  also, there are a bunch container classes ( vector, list, map, etc. ) which has bounds checking and suits a lot of different needs and they should always be preferred over dynamic arrays.  there are many basic algorithms already coded.  and, finally, there is a std::string class with full string semantics which replaces char* ( when you see any example talking about strxxx functions instead; run away.  that means they are talking about c-style strings )  heck, even the i/o is fully object oriented.  old timers would talk about printf, atoi, FILE*, etc.  yet, a good c++ programmer would know the power of iostreams

any c++ book, that doesn't talk about these is a bad book.  i would suggest reading "STL Tutorial and Reference Guide: C++ Programming with the Standard Template Library" by David R. Musser, et. al ( make sure you get the 2nd. ed. )  alternatively, you might wanna try "The C++ Standard Library - A Tutorial and Reference" by Nicolai M. Josuttis, which is an excellent book ( also covers iostreams very nicely ) but not necessarily suited towards starters

another alternative is at,

    http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

this might be the best link for you because if you download the html version of the book, it has an interactive index, which means you can lookup for certain topics and immediately see examples and explanation.  alternatively, you can read through the book like a regular book, too ( it almost reads like a novel ).  this link points to a free downloadable version of bruce eckel's very good "thinking in c++" book, which is a 4.5/5 stars book on amazon and a $30 value

note that, this book is not as good as the previous two, especially not at the josuttis caliber but it's still a good one.  yet, it does *not* remove your need to buy one of those previous books for improving your STL skills

so, to summarize:  it's common for books to start talking about pointers, char*, arrays, etc. when teaching c++ but the real c++ lies within STL and iostreams.  learn those and never mind the other details.  i have been doing c++ programming for years now and have been involved in very large projects and never felt the need to use c-like features of c++, other than when i needed to connect to a legacy c api

oh, almost forgot:  if you are into GUI building and you want to do that under Windows, C++.NET is a good choice.  standard c++ does not have a GUI toolkit and thus you are always gonna end up using a platform-specific of vendor-specific api for that purpose.  thus, you might choose C++.NET as well.  note that, if you are really into GUIs and windows programming, then i suggest you to skip c++ altogether and to learn microsoft's c#, which is java-like and better suited for windows programming
the book i had covered STL and iostreams - i don't know if it covered them completely, but it seemed fairly extensive to me

i don't know about C# b/c it seems like no one is using it - am I wrong in this biased opinion? :-)
if u really want to appreciate the "POWER" of C++ in the sense of its being closer to machine .. then first get the feel of C. C++ is nothing but C with objects and classes stuff.  ( yes there is objective C also).

as burcarpat already mentioned .. pointers and all that sort of stuff is more of C than C++,
and also  if u r fascinated about having  closeness with machines in terms of (programming language), then  how come you havent heard of Assembly language as yet?
 may be u heard but didnt accept it as programming language?

 



ASKER CERTIFIED SOLUTION
Avatar of Salte
Salte

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Okay.  Thanks for all the help.  Looks like there are many different ways to go w/ this.  ALf, since yr questions obviously took tons of time to write, I will give you the points.  Sorry I can't give some to everybody who responded.
Oh man!!! Salte that post is long winded even for you!!! :-)
Salte, have you written any books about C++? You seem to know enough to have done so.
nice post salte..
>>Salte, have you written any books about C++?
yea lets us know if u have written books .
Never written any, probably could if I were asked to but nobody has ever asked me to write one :-)

I heard of C++ back in 1985 and was thus probably one of the first to hear of the language. In those days it was called "C with classes" the name C++ came later. Bjarne Stroustrup had a presentation of the language in the company I worked for at that time. In those days I mostly programmed in a propietary language used by that company and had just recently learned C.

I wrote most of my programs in C since around 1988 and programmed C++ actively since around 1989 and used both C and C++ actively since then so I think I know the language pretty well :-)

If anyone want me to write a book, let me know :)

Alf