From owner-freebsd-questions@FreeBSD.ORG Tue Nov 11 08:13:21 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D6CAF16A4CE for ; Tue, 11 Nov 2003 08:13:21 -0800 (PST) Received: from lilzmailfe01.liwest.at (lilzmailfe01.liwest.at [212.33.55.13]) by mx1.FreeBSD.org (Postfix) with ESMTP id 79E6043FE0 for ; Tue, 11 Nov 2003 08:13:18 -0800 (PST) (envelope-from dgw@liwest.at) Received: from [212.33.58.27] (helo=cm58-27.liwest.at) by lilzmailfe01.liwest.at with esmtp (Exim 4.14) id 1AJb8l-0004ul-G4; Tue, 11 Nov 2003 17:13:15 +0100 From: Daniela To: freebsd-questions@freebsd.org, Louis LeBlanc Date: Tue, 11 Nov 2003 17:08:47 +0000 User-Agent: KMail/1.5.3 References: <00f201c3a7dc$40706fa0$6400a8c0@desktop> <3FB0295C.70602@mindcore.net> <20031111135435.GA396@keyslapper.org> In-Reply-To: <20031111135435.GA396@keyslapper.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200311111708.47643.dgw@liwest.at> Subject: Re: Another Newbie Question: C or C++ X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Nov 2003 16:13:22 -0000 On Tuesday 11 November 2003 13:54, Louis LeBlanc wrote: > On 11/10/03 07:12 PM, Scott W sat at the `puter and typed: > > 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... > > Wow, that's a fairly complete list. Agree completely on the C/C++ > application/philosophical differences. The book list missed one very > useful C++ book by Josutis, "The C++ Standard" I think. Don't have it > handy. > > You know, everyone's been telling me to give up C and just start > working with C++. I've been resisting pretty strongly, and now I > realize why. C is a geeks language. It gives you more control than > C++. I like C for one primary reason: I like to be in control. I > know that many of the C++ constructs, member functions, etc. are slow > in comparison to home grown vanilla construct in C that only do what > they are needed for. The standard template classes use table lookups > just to figure out what its contents look like. If you create the > construct from scratch, it knows whether it's holding an int, char*, > or struct. > > And the arguments about faster machines meaning that level of > efficiency is unimportant will fall on deaf ears here. Efficiency > should always be in the top 3 list (correctness, stability, and > efficiency are the trinity of the true programmer). > > I'm gonna stop here because this is going to turn into a holy war > shortly, but take Scott's description of the applications, > availability, and books to heart. The only thing I can really add > (for all my babbling here) is the Josutis book for C++. I can recommend "Who's afraid of C++?" by Steve Heller. It's good as the very first programming book to read, very easy to understand. Daniela