Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Any reason to use C?

Author: Ulrich Tuerke

Date: 14:23:47 07/31/03

Go up one level in this thread


On July 31, 2003 at 15:57:51, Robert Hyatt wrote:

>On July 31, 2003 at 11:16:32, Ulrich Tuerke wrote:
>
>>On July 30, 2003 at 17:15:11, Robert Hyatt wrote:
>>
>>>On July 30, 2003 at 16:52:47, Gerd Isenberg wrote:
>>>
>>>>On July 30, 2003 at 00:00:54, Robert Hyatt wrote:
>>>>
>>>>>On July 29, 2003 at 22:10:11, Matthew White wrote:
>>>>>
>>>>>>On July 29, 2003 at 22:08:13, Robert Hyatt wrote:
>>>>>>
>>>>>>>On July 29, 2003 at 20:16:59, Matthew White wrote:
>>>>>>>
>>>>>>>>On July 29, 2003 at 16:53:05, Vincent Diepeveen wrote:
>>>>>>>>
>>>>>>>>>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.
>>>>>>>>>
>>>>>>>>The best reason that I see to teach students using Java is that Java gives you
>>>>>>>>useful information when an error occurs (remember the first time you saw a
>>>>>>>>segmentation fault how lost you felt?). Java has strong typing and it FORCES
>>>>>>>>object orientedness. C and C++ are too frustrating for new programmers...
>>>>>>>>
>>>>>>>>Matt
>>>>>>>
>>>>>>>
>>>>>>>Strong typing was also Pascal's claim to fame.  Thankfully it died a
>>>>>>>graceful death.
>>>>>>
>>>>>>It was good for teaching, though...
>>>>>>
>>>>>>Matt
>>>>>
>>>>>
>>>>>Depends on your ultimate goal.  If you are going to be a programmer, it is
>>>>>not the best way to go.  If you program in Java for 4 years, then leave and
>>>>>go to work where they use C, you have a _long_ learning curve.  You've never
>>>>>seen pointers, for example.
>>>>
>>>>Bob, that may be true - but if they do Java in their job, the learning curve is
>>>>rather short, if not zero.
>>>
>>>I already said that.  But for large IT organizations, Java is not an
>>>option.  C/C++ and COBOL are dominant, still.
>>>
>>>
>>>>
>>>>In my working environment i found the trend goes to Java. Huge business
>>>>client/server applications with Java application server like Bea and JBoss.
>>>>I found Java-beans much more intuitive than C++ based component ware i used so
>>>>far, but still a newbie in this field. Have you ever used COM (the better C++?!)
>>>
>>>No to COM...
>>>
>>>
>>>>or MSXML-DOM with ms-smartpointer?
>>>>
>>>>I learned in the "bottom-up" way, from assembler close to hardware to Pascal and
>>>>later C/C++. I had clear imaginations what an address or a pointer is.
>>>>
>>>>In the meantime with C++, i prefere the reference synonym instead of pointer,
>>>>only because of syntax ( a=b instead of *a=*b, passing a,b instead of &a,&b and
>>>>only a prototype with (int &a) instead of (int *a).
>>>>Due to my career i'm not sure what's the "best" didactical way to teach "call be
>>>>reference" or "call by pointer" first, may be very individual.
>>>
>>>
>>>I learned assembly first, then FORTRAN and then others.  The point is that it
>>>is far better to learn your main programming language (for your career) first,
>>>rather than later.  Learning syntax is easy.  Learning semantics is not as
>>>easy.  Experience to become a _good_ programmer in a specific language takes
>>>_much_ longer.
>>>
>>>By the way, the two calling conventions are commonly called "pass by value
>>>(where a copy of the value is passed, as in FORTRAN)" and "pass by reference"
>>>(where a pointer to the value is passed).
>>
>>I think that you are wrong here: good old Fortran passes parameters by ref..
>>C is an example for "pass by value".
>>
>>Uli
>>
>
>You are right.  However IBM modified fortran years ago so that you could
>put // around a variable and "pass it by value".  So you could do it either
>way, just as in C.  The only difference was that looking at the code, you
>could not tell whether a=a+1 was modifying a copy of a, or the original back
>in the calling program...
>
>the // stuff was done on multiple fortran compilers, but I'm not sure it was
>ever a "standard" (although many vendors, cray included, even added pointers to
>fortran as another language extension).

It was similar with DEC Fortran. IIRC, you could modify the passing mode of
Fortran by
func(%VAL(arg))  or func(%DESC(arg)) or func(%LOC(arg)). This had been
particulary useful for mixed language programming, e.g. combining C and Fortran
modules.

Uli

>
>>>
>>>
>>>
>>>>
>>>>Gerd
>>>>
>>>>>
>>>>>We took a _lot_ of heat about that from companies like BellSouth.



This page took 0 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.