[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++

From: Bas Wijnen
Subject: Re: C++
Date: Wed, 23 Sep 2009 18:31:41 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, Sep 23, 2009 at 12:59:06AM +0200, address@hidden wrote:
> Unfortunately, in spite of the name and resulting general perception,
> C++ can not really be considered an evolution of C. While it adds a
> couple of useful features, and a couple of features considered useful by
> some, it also takes away an essential feature of C -- its elegance.

Not at all.  You can still write C code in C++, which means that
whatever you consider elegant is still possible.  If you mean that it is
possible to write horrible code in C++, then I agree.  But that is very
easy in C as well.  Both languages allow many things, which is what
makes them so powerful.  But with great power comes great
responsibility. ;-)

> On Tue, Sep 15, 2009 at 06:26:10PM +0200, Bas Wijnen wrote:
> > Of course Richard Stallman is a known hater of C++.  He has a point
> > that everybody knows C, so using that makes the code readable for
> > everyone. [...] IMO his love for C is unreasonable.  
> Richard Stallman is not a C++ hater,

I heard that the egcs fork of gcc was really a quarrel between him and
people who wanted a C++ port integrated into it.  Not that I followed
anything about it back then, so it may be nonsense.

> If you want to cite an actual known C++ hater, take Linus Torvalds.

I wasn't aware of this, but somehow it doesn't surprise me at all, given
his strong opinions on everything. :-)

> I must say that I fully agree with him on this. His argument makes
> perfect sense:
> > C may still be useful in some places, but not in big projects.
> Neither is C++ suitable for big projects.
> Linus' argument is that for the kind of low-level code where C is
> useful, C++ doesn't offer any advantages; only problems.

I thought this as well, but I have found that using only a few features
(in particular organizing code in classes with member functions, instead
of creating interfaces which pass their object as an explicit first
argument) will really make the result a lot more readable.  Of course
using C++ doesn't give any problems at all, as long as you use it
properly.  Unless you consider "I'm unable to use 'new' as an identifier
name" a problem.

> While for the kind of code where a higher-level language is more
> useful, you better use a true high-level language.

I come from real low-level languages (assembly and sometimes even raw
machine code), and C++ is high enough for me. ;-) It is well possible
that some other languages offer even more.  I just haven't discovered
those languages yet.

> > However, our main interest is not that everyone can read our code.
> Free software is about enabling people to understand and adapt the
> software. An obscure language is a major obstacle.

Yes, I agree.  As I wrote, it is a good thing if many people can read
our code.  But it is more important that we can efficiently write good
code.  It obviously helps to combine the two.  But if both cannot be
accomplished together, IMO actually getting the code written is more
important than making it readable.

Additionally, the point about free software you cite is that it is
useful for educational purposes.  It does not make sense to teach people
to use a language which really isn't the best tool for the job.  So if
you would think that C is not the best language to write a kernel in,
doing it anyway "because people can learn from it" isn't actually a good
idea.  Those people should better learn the other language first, and
then they can see how it should really be done.


Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]