From: Bertie Newsgroups: alt.comp.lang.learn.c-c++,comp.os.msdos.djgpp Subject: Re: Which is best? C or C++ ??? Date: Tue, 16 Dec 1997 16:08:52 -0800 Organization: CTS Network Services Lines: 62 Message-ID: References: <348a15e5 DOT 826895 AT news DOT clear DOT net DOT nz> <01bd0a80$b482bb00$a47de3c7 AT merlyn> NNTP-Posting-Host: wagasa.cts.com Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <01bd0a80$b482bb00$a47de3c7@merlyn> Cache-Post-Path: wagasa.cts.com!unknown AT isis DOT talaris DOT com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On 16 Dec 1997, ~liquid~ wrote: > [unknown] wrote: > Can someone break through all the hype for me. Which is the better > > language C or C++? I suppose I should qualify it. > > > > 1. Some people say that C is more efficient than C++ but does this > > still matter with the faster computers, eg 486s, Pentiums. How much > > more inefficient is it? > > > > 2. The claim is also that it reduces runtime bug hunting. However > > I've noticed that C++ is also more complex and executes code hidden > > behind the scenes. eg. constructors, destructors, > > operator-overloading. Are the runtime bugs just manifesting in > > different ways? > > Any comments? > > I thought that the object oriented nature of C++ would give it a leg up on > the older version? > I haven't learned C yet but I've read a book on C++ and it emphisized the > introduction of new > statements allowing for more "bug free" programming by constraining it to > limit the uses. > a prime example is the "goto" statement.. From what I've read it should be > avoided as much as possible > > To anyone considering learning C or C++, I would say this: For the first couple of years of your programming life, runtime efficiency is going to be much less of a concern to you as simply getting your code to compile and run. And any inefficiences that are the result of your choice of programming language will pale into insignificance when compared with the inefficiences caused by novice programming techniques. I design 'hard' realtime systems that run on a variety of RISC and CISC micros. My language of choice is C++, and I use whatever features of the language I deem appropriate for the task at hand. If performance does not meet the goals, I look at the code to determine if it can be simplified. Sometimes that may mean that my code starts to look a lot like C, and sometimes I must resort to assembly language. Where performance is less of an issue, and better data abstraction can benefit the project, then my code starts to draw on some of the more esoteric features of C++. C (for most practical purposes) is a subset of C++, and I personally have never found myself wishing that I had a C compiler at hand. There are many ways that C++ is a 'better C.' Catching problems at compile time (before they become problems ar runtime) is one of the strengths of C++. Better type-checking; automatic initialization of data objects; exception handling; data hiding etc, all help to make C++ a better tool for creating just about any type of program. No argument in my mind: go for C++! Regards, Bertie //---------------------------------------------------------------------------- // "Bertie" is a pseudonym. (I hate spam!) //----------------------------------------------------------------------------