From owner-freebsd-questions@FreeBSD.ORG Tue Nov 11 19:06:01 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 ACD8816A4CE for ; Tue, 11 Nov 2003 19:06:01 -0800 (PST) Received: from ms-smtp-01-eri0.southeast.rr.com (ms-smtp-01-lbl.southeast.rr.com [24.25.9.100]) by mx1.FreeBSD.org (Postfix) with ESMTP id 235A243F85 for ; Tue, 11 Nov 2003 19:05:55 -0800 (PST) (envelope-from wegster@mindcore.net) Received: from mindcore.net (rdu163-100-105.nc.rr.com [24.163.100.105]) hAC35ans022163; Tue, 11 Nov 2003 22:05:40 -0500 (EST) Message-ID: <3FB1A381.9060903@mindcore.net> Date: Tue, 11 Nov 2003 22:05:37 -0500 From: Scott W User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alex Kelly References: <002c01c3a8c1$a4651bb0$6400a8c0@desktop> In-Reply-To: <002c01c3a8c1$a4651bb0$6400a8c0@desktop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Symantec AntiVirus Scan Engine cc: freebsd-questions@freebsd.org Subject: Re: Newbie: The C / C++ Issue 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: Wed, 12 Nov 2003 03:06:01 -0000 Alex Kelly wrote: >Thanks for all of the great suggestions to my previous question! > >Yet, the responses have led me to another question. If C++ is newer and more advanced than C, will it replace C? If so, should I learn C++ and forget C? > >Alex > > Again, it depends on WHAT you'd like to program. That isn't to say you CAN'T program a specific type of application in language X, but some languages lend themselves to different tasks better. C++ was supposed to 'replace C' since the 80s or so. It's become more predominant for applications than C in _most_ cases, but the core OS of *bsd, Solaris, HP-UX, AIX, etc etc are all C. Device drivers are written in C. A large number of system daemons/services are written in C. And yeah, because C lets you 'do as you want,' there are also some buggy C programs out there ;-) C++ may be a bit much if it's your first programming language. There are things in CC++ that are ambiguous, moreso than in C- like the number of possible uses for the keyword 'const' among others (&$^#*&), and STL can be a _handful_ if you've never learned how to 'roll your own' data structures. C pointers are at the same time a wonderful thing and a PITA to deal with at times. C++ is generally MUCH fmore suited to GUI programming, and a few other tasks...but: If you learn C first, and become competent at it, when/if you move on to another language, you'll have a better understanding of what's going on even if the 'next language' hides significantly more from you and makes your life easer (less coding, more use of libraries, foundation classes, STL, etc). It's also not a terrible thing to learn C, and then ease into C++ simply as a 'better C'- stronger type checking, warnings that are now errors, and if pointers freaked you out TOO badly in C, you can then breathe a sign of relief and 'cheat' and use some of the functionality of C++ like references.. If you DO go that route (C first), it's likely you'll be a better programmer in the end, seriously- starting with C++ can be like trying to run before you realize you have feet, and can result in 'knowing' C++, but writing code that no one in their right mind wants to touch.. starting in Java is akin to someone being shown how to fly, but not knowing how to land, or turn, or much else ;-) Possibly not the best phrasing, but I've met MANY programmers that are very good at one specific thing, but put them even slightly out of their element (like umm, take Java away from them and make them use a 'real' language!) and they're extremely confused- mention POSIX system calls and they go blank... The best thing I can suggest, which I do myself when I try to _force_ myself to get Java more solidly into my skillset, is to first learn 'a bit.' Go through one of the recommended books (and BTW, whoever said Eckel's TIC++, yep, good call, missed that one although it's on all of my systems HDs :-) and DO the excercises. Pace yourself, especially while learning, and don't think 'you know that already' and skip over excercises and questions, no matter how inane some of them may seem ;-) Then, pick a 'real' project you'd like to do, starting reasonably small, maybe a small part of a larger project...or pick up Steven's APUE and write a talk daemon and client or something similar....you'll find things that you thought you knew that you realize you have no idea about. One of the niceties of *nix are the man pages- if you're looking for a specific function (in the standard C library or system calls), try: man -k where is a single word, like: man -k open will return a LOT of summaries of man pages with their headers including the word 'open.' man man or man intro to get info on limiting them further, but you'll find youself using man pages a LOT while you go through your project, whatever it is. Complete the first one, whatever it is, and then pick up the next book, then go a bit more ambitious, and use what you've got so far along with what should now be more 'reference' books than 'teaching books' and keep going....use the force, Luke ;-) Ok, I'll shaddup now... Did you catch the subtle hint in there to start with C? ;-) Scott