Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Any reason to use C?

Author: Bo Persson

Date: 11:17:11 07/29/03

Go up one level in this thread


On July 28, 2003 at 20:50:49, Tom Likens wrote:

>On July 28, 2003 at 19:00:41, Dieter Buerssner wrote:
>
>>On July 28, 2003 at 18:26:29, Gerd Isenberg wrote:
>>
>>>References, function inlining and namespaces are enaugh to use C++.
>>
>>Gerd, references is enough for me, to avoid C++. In the "old days", when I read
>>code with a function call, like foo(a), I was sure, that a will be the same
>>after the function call, than before. With C++, I cannot be sure anymore. If I
>>want to make a changable by a function call, I use &a in C. All pretty much self
>>documenting. Not anymore in C++.
>>
>>It may even be a performance issue. I read your suggestion about the small
>>inline functions vs. macros. I basically agree. But when using reference
>>paramaters (your example did), things might be very different. This might make
>>it very difficult or even impossible to make a good optimization for the
>>compiler.
>>
>>Function inlining is part of the ISO C Standard of 1999. Not all compilers
>>support it.
>>
>>Regards,
>>Dieter
>
>I'm a fan of C++ but I agree with this completely.  I made it a practice
>long ago, that if the any routine changes the parameters passed to it
>then the parameters need to be passed via a pointer.  Otherwise, there
>is no visual indication that they are being altered, which is a no-no.
>Any other policy, seems to invite subtle bugs.

Unless the policy is to name the function so that you can tell what it does. :-)

Seriously, considering calling conventions each time you call a function takes
your focus to the wrong level of the abstraction, IMO.


>
>That being said, I still believe the benefits of C++ outweigh the
>negatives.  I love the STL and the entire concept of generic programming
>provides tremendous power.  The real problem (IMHO) with C++ is that
>there are large number of ways to blow your feet off with it.

 "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when
you do it blows your whole leg off." (B Stroustrup)



Bo Persson
bop2@telia.com



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.