[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnubg] GNUBG / GNU Coding Standards - C and or C++ - feedback w
Re: [Bug-gnubg] GNUBG / GNU Coding Standards - C and or C++ - feedback wanted
Thu, 13 Feb 2014 15:39:43 +0100
I must admit that I'm not a big fan of C++ but at least it does not
make me sick (like Perl does).
I usually have problems seeing what you can gain from using C++ over C?
+ you get better abstraction with C++.
+ you get templates which may simplify some things.
+ you get operator overloading.
+ you get a real inheritance system.
(I'll keep STL and Boost out of this list as I consider these
something else than C++)
Yes, these are sometimes good things, but I opt to say these could be
bad things as well. True: you get better abstraction. Templates
however can give really strange side effects. Operator overloading is
also a feature that takes away control of the programmer, and can lead
to hours in the debugger. I also see really little use for operator
overloading in backgammon software. Maybe in the search algorithm can
overload > and < ? Maybe a board type can operator overload + for a
move to apply the move to a board. But really, I don't feel that
enhances the readability.
Getting a real inheritance system is not only good either. OO Designer
will say that you should basically not inherit, since inheritance is
the hardest coupling of them all. HAS-A is better than an IS-A.
Abstract types and interfaces are ok, but you can mimic that in C as
well. (Abstraction C can also be really good!)
I would say that we should stay away from C++ at any means, but rather
make a lower level interface to Python.
Just my $0.02.
On Thu, Feb 13, 2014 at 2:56 PM, Michael Petch <address@hidden> wrote:
> Howdy All,
> Last July Richard Stallman made one significant change to the GNU Coding
> Standard so that it no longer prefer C to other such languages.
> This was a significant departure from the original coding standard which
> preferred C over other languages, and chided C++ in particular.
> The latest coding standard can always be found here:
> I am curious what people think of having C++ modules as part of the
> mainline source code tree.
> In particular I was thinking of using code compatible with C++98. Are
> there environments we are targeting that don't have access to a C++
> compiler? or where G++ isn't available etc?
> Would appreciate any thoughts people may have on this.
> Michael Petch
> CApp::Sysware Consulting Ltd.
> OpenPGP FingerPrint=D81C 6A0D 987E 7DA5 3219 6715 466A 2ACE 5CAE 3304
> Bug-gnubg mailing list