Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Nov 2003 19:12:12 -0500
From:      Scott W <wegster@mindcore.net>
To:        Alex Kelly <alexkelly@adelphia.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Another Newbie Question: C or C++
Message-ID:  <3FB0295C.70602@mindcore.net>
In-Reply-To: <00f201c3a7dc$40706fa0$6400a8c0@desktop>
References:  <00f201c3a7dc$40706fa0$6400a8c0@desktop>

next in thread | previous in thread | raw e-mail | index | archive | help
Alex Kelly wrote:

>I need to buy a book on C or C++ to help me in FreeBSD. Which would be better to buy?
>
>I first thought a book on C would be best, because the OS is written in C. But, now I'm not sure because I read that gcc can compile C++ too (so, I'm assuming C++ must get used too).
>
>Does it even matter?
>
>Suggestions?
>_______________________________________________
>freebsd-questions@freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
>
>  
>
It depends on your goals.  I used to teach both C and C++, and now years 
later, am currently hard pressed to find a non-Microsoft C/C++ 
development position.  If for personal knowledge, definitely C followed 
by C++.  If professional, or want to be....hmm.  In that case, I'd say 
it still depends more on your goals- if you're going to try to stay in 
*nix development, you've GOT to know C.  If you don't care, or God help 
you, want a job doing Windows development, start with C++, and  ignore 
all of the standard data types because MS will make their own for you ;-)

Starting with C has an advantage in that you tend to have to do 'most of 
the work yourself' for a lot of things, which tends to help you 
understand more about how things work.  IMHO, that also tends to make 
better programmers down the line, regardless of the language they use.  
C++ is similar, but STL will make life easier when it comes to data 
structures.  Java I don't want to talk about ;-) 

A significant amount of system level programming(think system processes 
and services/daemons) are written in C.  A fair number of applications 
are, but the majority of GNOME/KDE apps, if that's a consideration, are 
done in C++.  A growing number of applications are also being done in 
Java, but it's not the best language to start with for understanding 
much of anything (you can write a half dozen lines of Java to replace 
perhaps 100+ in C/C++ from scratch in some cases).  It isn't a bad 
language to learn (professional-wise as well, *groan*) after learning C 
or C++.

Books and references-
C- Already mentioned, K&R 'The C Programming Language' is 'the bible.'  
This is also generally a lousy book to start with if you aren't 
programming already, but an invaluable reference.  Pick up another book, 
wish I knew a good starter one, but it's been a while...can try Deitel 
and Deitel or (nobody laugh, have used it for Intro before..) the 21 
days SAMs series for a 'jump-start,' and THEN the Deitel/Deitel and K&R.

W. Richard Stevens "Advanced Programming in the UNIX Environment"- MUST 
HAVE.  I may be misquoting the name, but a search on bookpool.com , 
bn.com (or search on amazon then BUY somewhere else!) will quickly turn 
it up.  K&R is to the C language, Stevens is to Unix programming...

google search for 'Secure Unix Programming'- there's a FAQ or two out 
there that are pretty good once you're past 'the basics.' 

C++
Latest edition of Deitel/Deitel.  Funny, I used to really dislike their 
books, but they DO provide pretty decent overall coverage.  May or may 
not be 'too deep' at first, if so, preface with SAMs or equivalent.

Stroustrup- 'The C++ Programming Language".  Stroustrup write C++ but is 
pretty dry.  Good reference and for advanced topics.
Stroustrup- Annoted Reference Manual AKA 'the ARM'- what K&R is to C.
*The C++ Standard Library : A Tutorial and Reference- recommended pretty 
highly, but don't currently have.  search on favorite bookstore will 
turn it up.

*Java (before ya ask ;-)  There are a LOT of bad books on Java it 
seems.  Deitel and Deitel again is worth buying as a first book (after C 
and/or C++), then decide what you want to DO with Java, as there are a 
number of directions- JDBC, Beans, JSP, etc etc etc..

As always, languages and books can be a moving target- when possible, 
pick up the latest edition covering the current ANSI standard for C/C++, 
and make sure anything you buy for Java covers 'Java 2,' preferably JDK 
1.4, but at least 1.3 or you'll be throwing out work by the time you 
work on a current project..

Misc others-
POSIX Programming, O'Reilly press.  Good coverage of POSIX (Unix for 
simplicity's sake but not really) required system calls.

Network Programming- Again,m by Stevens.

FAQs for whatever you wind up taking an interest in.  I don't _like_ GUI 
development, but KDE and GNOME have a fair number of tutorials for QT 
and GTK respectively...

Scott




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FB0295C.70602>