Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Any reason to use C?

Author: Hristo

Date: 00:15:54 07/29/03

Go up one level in this thread


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)
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
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
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...

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. ;-)

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.