Author: Vincent Diepeveen
Date: 13:53:05 07/29/03
Go up one level in this thread
On July 29, 2003 at 03:15:54, Hristo wrote: >On July 28, 2003 at 19:12:56, Vincent Diepeveen wrote: > >>On July 28, 2003 at 17:34:46, Russell Reagan wrote: >> >>>Is there any reason to start new projects with C anymore? It seems like most (if >>>not all) of the drawbacks of C++ have faded away with modern compilers. >>> >>>Note that I am talking about new projects, and maintaining old projects is >>>obviously a good reason to still use C. >> >>If i would learn coding today i would prefer C++. >> >>However let's be clear, for good programmers there is not much diff between C >>and C++. Every complex problem which you can solve in 10000 lines of C++ you can >>solve in 10000 lines C too. >> > >Vincent, >with all due respect I must disagree. In 10K lines of C++ code one can solve a >much more general or larger set of problem(s) or cram in more features. :) >(think templates, exceptions, and often inheritance ... all of which can shorten >your code) I do not know about you, but i program both in C and C++. Do you? Not a single program where you can use all the nice toys you can also make a few functions for in C. In general the average programmed C++ program you program more compact in C. That's not what i'm talking about. If you do not know how to program in C, then just say it loud instead of writing it down like this. the advantages of what you mention here (assuming 1 man products) you can show great in 50 line examples or even 200 line examples. But as soon as you write a 10000 line product then it doesn't matter what you do in C++. I can do the same in C too. No problem! >In your post, latter, you indicate that C++ offers some advantages over C, >especially for large projects. In my experience this is %100 true, so we are in I see no other advantages to C++ than for big projects in fact. The advantage is *really* huge there for companies. Given the importance of those companies for the world, the choice to teach students C++ instead of C is a logical choice. teaching them Java, delphi i find a bad idea. sometimes fortran is needed though because all libraries are in fortran. >agreement, but C++ offers extra features at all levels and C++ often imposes >performance penalties because of it. Sometimes C is better because you don't You should realize that if i understood well, some early C++ compiler generated C code out of it which then was optimized further. There is really *nothing* which C++ offers that you can't get to work in C either. If a product becomes bigger (10000+ lines) then you can create in C a lot of functions which you can reuse everywhere. So where you focus upon 1 feature that C doesn't have, the savings that C books is in the functionality below it, because the product is designed in a different way. >have to deal with the _nice_features of C++. If speed and size are important >then C, even assembler, might be the right choice. However, beginners in the >field (programming) believe they can d a better job at implementing already >available features/functions... In general i find assembler a bad idea to use. It is a public secret that most C++ projects tend to use too much code to get a simple thing to work. Way more than they could need. This is true. But usually commercial projects are programmed by employees who must write each hour. >BTW, >there is another paradigm "Objective-C" which is, in some cases, absolutely >amazing way of doing things, but it could get slow and cumbersome. >More features always cost something and the cost is usually speed. ;-) In general the average programmer has no idea bout speed. They do not even know how to loop through an array usually taking advantage of features like fall through of the processor. It isn't easy indeed. So taking that into account such high level languages like C++ and objective C and smalltalk and java are very slow indeed. >Regards, >Hristo > >>No big deal. >> >>Only some 50 line examples C++ looks more powerful. >> >>However for large projects there C++ is really a major advantage. If one >>programmer messes up his object then for large projects the type checking and >>array checking is way easier. >> >>Of course the extra features in c++ means theoretical that there is more chances >>to mess up and to create hidden bugs which are real hard to find, more than in >>C. >> >>In that sense C and C++ are the same. >> >>I wrote a big athletics time tracking program in C++ when i was 17 years old. it >>was finished when i was 18 and they didn't need it by then as they had already >>some better commercial solution then (the athletics club). >> >>However when i was 15,16,17 i had written a big chess interface, which when i >>was 20 would be using for DIEP. For those days the interface was great. >> >>VGA support even. >> >>By modulair setting up the engine i ensured that at university i could run the >>engine without graphical interface. >> >>Note that under dos i had no option but to INTEGRATE the interface and the >>engine. So i have a diepasci.c, my dos text interface i/o which is even till >>todate existing, which is just: >> 19-07-2003 19:56 21.884 diepasci.c >> >>And i had a 140KB diepmenu.c which was the graphical DOS interface which i could >>exchange for diepasci.c >> >>Both having the 100% same functionality. >> >>Great work at the time when DOS didn't know the word multithreading or >>multiprocessing yet. >> >>So there really isn't a difference for a one mans product at all if you are good >>in dividing and conquering. >> >>However for large projects i really see the advantages of C++. >> >>Reality will be however that even the best set up c++ projects will suffer from >>the same bugs a C project would. Yet it is at least a bit more clear now who to >>blame for bugs B. >> >>In a one mans product that is not the case. >> >>So as most of us won't be writing one mans products only, C++ is trivially >>better to use.
This page took 0.03 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.