You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Behlendorf <br...@hyperreal.org> on 1998/03/11 09:46:54 UTC

the C++ disaster (was Re: Source code - optimised assembler)

feul for the fire.

>Delivered-To: brian@hyperreal.org
>Resent-Date: Wed, 11 Mar 1998 00:42:37 -0800 (PST)
>To: mozilla-general@mozilla.org
>Path: not-for-mail
>From: Jamie Zawinski <jw...@netscape.com>
>Newsgroups: netscape.public.mozilla.general
>Subject: the C++ disaster (was Re: Source code - optimised assembler)
>Date: Wed, 11 Mar 1998 00:42:02 -0800
>Organization: The Mystic Knights of Mozilla, http://www.mozilla.org/
>Lines: 28
>NNTP-Posting-Host: h-205-217-227-10.netscape.com
>X-Mailer: Mozilla 3.02 (X11; U; IRIX 6.3 IP32)
>Resent-From: mozilla-general@mozilla.org
>X-Mailing-List: <mo...@mozilla.org> archive/latest/1547
>X-Loop: mozilla-general@mozilla.org
>Resent-Sender: mozilla-general-request@mozilla.org
>
>G. Sumner Hayes wrote:
>> 
>> Netscape chose C for some parts of the code and C++ for others, and
>> while those may or may not be the best possible choices they're
>> certainly reasonable ones.  They've dealt with the portability
>> problems pretty well so far, and I presume they have a reasonable
>> knowledge of available alternatives and the pros/cons of those.
>
>We have dealt with the portability problems, but at colossal cost.
>
>In my humble but correct opinion, it was a huge mistake to allow C++
>code into the cross-platform areas of Mozilla.  Those who advocated
>this underestimated the difficulty of the portability problems by
>at least an order of magnitude.  But, what's done is done; that's
>where we are today, and being able to say "I told you so" isn't much
>of a reward.
>
>Hopefully, if we get anything out of this pyrrhic victory, at the
>least we should be able to come up with a document that shows where
>the land mines are buried, and that will perhaps convince others not
>to run headlong into this same disaster in the future.
>
>It's too bad that most people don't get the fact that an object-oriented
>programming style has exactly nothing to do with the programming
>language you use.  
>
>-- 
>Jamie Zawinski         http://people.netscape.com/jwz/      about:jwz
>
>
--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
"Optimism is a strategy for making                         brian@apache.org
a better future." - Noam Chomsky                        brian@hyperreal.org

Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Ben Laurie <be...@algroup.co.uk>.
Paul Phillips wrote:
> 
> On Wed, 11 Mar 1998, Ben Laurie wrote:
> 
> > Indeed it is. But the comment was made with reference to the
> > cross-platform stuff. If he thought C++ was a bad idea everywhere, why
> > did he restrict the comment to the cross-platform stuff?
> 
> Maybe because that was his point -- that introducing C++ into the
> cross-platform parts of mozilla was a COLOSSAL mistake, whereas in
> the rest it was only a GIGANTIC mistake.  It's just as valid an
> interpretation.  There's every reason to restrict those kinds of
> comments to the specific subject at hand (portability in this case)
> so as not to come off like a langugage bigot.  "C++ sucks" is not
> a good way to convince people of anything.  "C++ seriously hindered
> mozilla portability" is much better.  It's only diluted by talking
> about aspects of C++ irrelevant to the central thesis.
> 
> I'm just going to ask him, though.

I'll be interested to hear the answer.

> > If he intended it to be a blanket comment on the utility of C++, why on
> > Earth did he qualify it?
> 
> See above.  I have to feel that C++ advocacy is really reaching when
> it's looking for endorsements by virtue of complaints about specific parts
> of C++.  "Well, this guy thinks that features X, Y, and Z of C++ suck,
> but that must mean he likes the rest."

:-) If that's what had happened, then yeah. But I was responding to a
criticism of C++. OK, maybe I overstated it, but the fact that a
Netscape employee says that Netscape had a bad experience with
inappropriate use of C++ is not really a condemnation of C++. In my own
inept way I was just trying to underline that.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|  Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author    http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Paul Phillips <pa...@go2net.com>.

On Wed, 11 Mar 1998, Ben Laurie wrote:

> Indeed it is. But the comment was made with reference to the
> cross-platform stuff. If he thought C++ was a bad idea everywhere, why
> did he restrict the comment to the cross-platform stuff?

Maybe because that was his point -- that introducing C++ into the
cross-platform parts of mozilla was a COLOSSAL mistake, whereas in
the rest it was only a GIGANTIC mistake.  It's just as valid an
interpretation.  There's every reason to restrict those kinds of
comments to the specific subject at hand (portability in this case)
so as not to come off like a langugage bigot.  "C++ sucks" is not
a good way to convince people of anything.  "C++ seriously hindered
mozilla portability" is much better.  It's only diluted by talking
about aspects of C++ irrelevant to the central thesis.

I'm just going to ask him, though.

> If he intended it to be a blanket comment on the utility of C++, why on
> Earth did he qualify it?

See above.  I have to feel that C++ advocacy is really reaching when
it's looking for endorsements by virtue of complaints about specific parts
of C++.  "Well, this guy thinks that features X, Y, and Z of C++ suck,
but that must mean he likes the rest."

-- 
Paul Phillips      | These pages look best if you come over and view them on
Cat Juggler        | my monitor.
<pa...@go2net.com> |     -- the essence of the modern web
+1 206 447 1595    |--------* http://www.go2net.com/people/paulp/ *--------



Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Marc Slemko <ma...@worldgate.com>.
On Thu, 12 Mar 1998, Ben Laurie wrote:

> 
> > You can always argue for every project done in C++ that it was just that
> > the programmers did it wrong.  If so, then all I can say is that C++ makes
> > it awfully easy to do it wrong.
> 
> We seem to have made a large leap here. Now you are saying that _every_
> project done in C++ has gone wrong. I can demonstrate several that

No, I'm not saying that I am just saying that saying C++ does not
have the property of being a bad language just because any example 
brought up can be due to the programmers doesn't make sense.

> haven't, and I'm sure I'm not alone. There are a lot of crap programmers
> out there, and they write a lot of crap code. Many of them write crap
> code in C++. This tells us nothing about C++.

No, but looking at trends does tell you things about C++.  If everyone is
a crap programmer, then perhaps it isn't the programmers at fault.  
Even if it is the programmers, if that is all you have to work with 
in terms of programmers then it doesn't matter who is at fault; choosing
C++ would be a bad idea.

My dislike of C++ isn't due to a dislike of OOP.  There are good
OOP languages that do work.  My problems with C++ are that it suffers
from being based on C too much.  C is a pretty low level language.
If I am going to use an object oriented language effectively, I
don't want a higher level language.

I am, however, not convinced that the gains from using an object
oriented language are that great.  Many of the concepts are good, but
they can be used in C.  Heck, I have seen books on object oriented
assembler.


Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Ben Laurie <be...@algroup.co.uk>.
Marc Slemko wrote:
> 
> On Wed, 11 Mar 1998, Ben Laurie wrote:
> 
> > Marc Slemko wrote:
> > >
> > > On Wed, 11 Mar 1998, Ben Laurie wrote:
> > >
> > > >
> > > > I have to say I find the comment curious anyway - presumably he'd have
> > > > liked to have seen C in C++'s place. But anything I can write in C I can
> > > > write in C++ (with maybe a few extra casts). So that wasn't really what
> > > > he was getting at, I suppose. I presume he must not like the way it was
> > >
> > > Oh, come on.  Saying that just because C++ is a nearly superset
> > > of C then there are no problems with C++ that aren't is C is bogus.
> > >
> > > Somehow, when people talk about writing C++ I don't think they mean
> > > talking about writing C code that just happens to be compiled
> > > by a C++ compiler.
> >
> > It is equally bogus to say that writing in C++ is not OK. That was my
> > point. There isn't a single way to write C++ that isn't C. Sounds like
> > the Mozilla guys got it wrong. If "right" meant, essentially, writing C
> > instead of C++, that still isn't an argument for discarding C++, is it?
> 
> If right means not using C++, then it sure is an argument for discarding
> C++.

Yeah. Dunno what I was smoking there (actually, I do, but I'm not
telling :-).

> You can always argue for every project done in C++ that it was just that
> the programmers did it wrong.  If so, then all I can say is that C++ makes
> it awfully easy to do it wrong.

We seem to have made a large leap here. Now you are saying that _every_
project done in C++ has gone wrong. I can demonstrate several that
haven't, and I'm sure I'm not alone. There are a lot of crap programmers
out there, and they write a lot of crap code. Many of them write crap
code in C++. This tells us nothing about C++.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|  Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author    http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Marc Slemko <ma...@worldgate.com>.
On Wed, 11 Mar 1998, Ben Laurie wrote:

> Marc Slemko wrote:
> > 
> > On Wed, 11 Mar 1998, Ben Laurie wrote:
> > 
> > >
> > > I have to say I find the comment curious anyway - presumably he'd have
> > > liked to have seen C in C++'s place. But anything I can write in C I can
> > > write in C++ (with maybe a few extra casts). So that wasn't really what
> > > he was getting at, I suppose. I presume he must not like the way it was
> > 
> > Oh, come on.  Saying that just because C++ is a nearly superset
> > of C then there are no problems with C++ that aren't is C is bogus.
> > 
> > Somehow, when people talk about writing C++ I don't think they mean
> > talking about writing C code that just happens to be compiled
> > by a C++ compiler.
> 
> It is equally bogus to say that writing in C++ is not OK. That was my
> point. There isn't a single way to write C++ that isn't C. Sounds like
> the Mozilla guys got it wrong. If "right" meant, essentially, writing C
> instead of C++, that still isn't an argument for discarding C++, is it?

If right means not using C++, then it sure is an argument for discarding
C++.  

You can always argue for every project done in C++ that it was just that
the programmers did it wrong.  If so, then all I can say is that C++ makes
it awfully easy to do it wrong.


Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Ben Laurie <be...@algroup.co.uk>.
Marc Slemko wrote:
> 
> On Wed, 11 Mar 1998, Ben Laurie wrote:
> 
> >
> > I have to say I find the comment curious anyway - presumably he'd have
> > liked to have seen C in C++'s place. But anything I can write in C I can
> > write in C++ (with maybe a few extra casts). So that wasn't really what
> > he was getting at, I suppose. I presume he must not like the way it was
> 
> Oh, come on.  Saying that just because C++ is a nearly superset
> of C then there are no problems with C++ that aren't is C is bogus.
> 
> Somehow, when people talk about writing C++ I don't think they mean
> talking about writing C code that just happens to be compiled
> by a C++ compiler.

It is equally bogus to say that writing in C++ is not OK. That was my
point. There isn't a single way to write C++ that isn't C. Sounds like
the Mozilla guys got it wrong. If "right" meant, essentially, writing C
instead of C++, that still isn't an argument for discarding C++, is it?

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|  Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author    http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Marc Slemko <ma...@worldgate.com>.
On Wed, 11 Mar 1998, Ben Laurie wrote:

> 
> I have to say I find the comment curious anyway - presumably he'd have
> liked to have seen C in C++'s place. But anything I can write in C I can
> write in C++ (with maybe a few extra casts). So that wasn't really what
> he was getting at, I suppose. I presume he must not like the way it was

Oh, come on.  Saying that just because C++ is a nearly superset
of C then there are no problems with C++ that aren't is C is bogus.

Somehow, when people talk about writing C++ I don't think they mean
talking about writing C code that just happens to be compiled
by a C++ compiler.


Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Marc Slemko <ma...@worldgate.com>.
On Thu, 12 Mar 1998, Ben Laurie wrote:

> 
> Huh? HTML parsing is platform independent. So is protocol. Cacheing is
> very nearly so. Security is orthogonal. We obviously have completely
> different ideas of what "cross-platform" means. Even HTML layout is
> platform independent (nearly) - though how you achieve the layout is
> obviously highly platform dependent.

If _a_ piece of code is cross platform, that means that it is 
essentially the same on all platforms.

If a piece of code is not cross-platform, then it needs different code
for each platform.

Portability in code that is different for each platform would logically
be less of an issue than for other code because it only has to be 
portable to a far smaller number of platforms.


Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Ben Laurie <be...@algroup.co.uk>.
Alexei Kosut wrote:
> 
> On Wed, 11 Mar 1998, Ben Laurie wrote:
> 
> [...]
> 
> > > I can tell you with extreme confidence that not only is he not talking
> > > only about UI, but in *no way* is he implying that C++ was a good idea
> > > everywhere else.  I've spoken with him about this specifically.  It's hard
> > > to misinterpret "colossal cost."
> >
> > Indeed it is. But the comment was made with reference to the
> > cross-platform stuff. If he thought C++ was a bad idea everywhere, why
> > did he restrict the comment to the cross-platform stuff?
> 
> Um, I'm going to have to disagree with you here, Ben. My interpretation of
> the comments agree with Paul's here. If I say "it's not a good

I'm going to give up on the argument - if anyone can find out the guy's
real opinion, then that's fine. There's little point in discussing what
it might be. BTW, it looks like you got chopped off there :-)

> 
> And I also am wondering why exactly you say that when he mentions
> cross-platform code, he means UI. Isn't that the one part of Navigator
> that, by definition, *can't* be cross-platform? Although personally I'd
> love to see code written for the Mac Toolbox compile using Win32, or Unix,
> it isn't likely to happen.

Isn't it? I could be wrong, but I suspect you'll be surprised when you
see the source. I assumed that cross-platform meant UI because it seemed
obvious to me that that is where most of the cross-platform issues are
for Mozilla.

> Cross-platform code likely includes things like protocol issues, HTML
> parsing and layout, cacheing, security concerns and the like. Which, by
> the way, is very near to what Apache does.

Huh? HTML parsing is platform independent. So is protocol. Cacheing is
very nearly so. Security is orthogonal. We obviously have completely
different ideas of what "cross-platform" means. Even HTML layout is
platform independent (nearly) - though how you achieve the layout is
obviously highly platform dependent.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|  Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author    http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Alexei Kosut <ak...@leland.Stanford.EDU>.
On Wed, 11 Mar 1998, Ben Laurie wrote:

[...]

> > I can tell you with extreme confidence that not only is he not talking
> > only about UI, but in *no way* is he implying that C++ was a good idea
> > everywhere else.  I've spoken with him about this specifically.  It's hard
> > to misinterpret "colossal cost."
> 
> Indeed it is. But the comment was made with reference to the
> cross-platform stuff. If he thought C++ was a bad idea everywhere, why
> did he restrict the comment to the cross-platform stuff?

Um, I'm going to have to disagree with you here, Ben. My interpretation of
the comments agree with Paul's here. If I say "it's not a good 

And I also am wondering why exactly you say that when he mentions
cross-platform code, he means UI. Isn't that the one part of Navigator
that, by definition, *can't* be cross-platform? Although personally I'd
love to see code written for the Mac Toolbox compile using Win32, or Unix,
it isn't likely to happen.

Cross-platform code likely includes things like protocol issues, HTML
parsing and layout, cacheing, security concerns and the like. Which, by
the way, is very near to what Apache does.

-- Alexei Kosut <ak...@stanford.edu> <http://www.stanford.edu/~akosut/>
   Stanford University, Class of 2001 * Apache <http://www.apache.org> *



Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Ben Laurie <be...@algroup.co.uk>.
Paul Phillips wrote:
> 
> [Sorry in advance for relative off-topicness.]
> 
> On Wed, 11 Mar 1998, Ben Laurie wrote:
> 
> > It is worth noting a couple of things here. First, he doesn't say that
> > C++ in Mozilla was a bad idea, only that it was a bad idea in the cross
> > platform stuff. Now, ask yourself what that means in the context of
> > Mozilla. That's right! It means UI. We don't have any UI. So, what he
> > didn't say, but clearly implied, was that C++ was a good idea everywhere
> > else. Which is to say, in all the kind of code Apache is.
> 
> I can tell you with extreme confidence that not only is he not talking
> only about UI, but in *no way* is he implying that C++ was a good idea
> everywhere else.  I've spoken with him about this specifically.  It's hard
> to misinterpret "colossal cost."

Indeed it is. But the comment was made with reference to the
cross-platform stuff. If he thought C++ was a bad idea everywhere, why
did he restrict the comment to the cross-platform stuff?

> > Another point he makes is that C++ may be object oriented, but that
> > doesn't make people program it that way (or he may be making the point
> > that C can be programmed in an object oriented way, but I assume not
> > because that is true only in an academic sense).
> 
> He's saying that abstraction and encapsulation have a lot more to
> do with the programmer than the programming language.  In other words,
> he's saying both, but I see more of the one that you're assuming he's
> not saying.
> I hate to act as interpreter, but that was a pretty gross
> misrepresentation ("clearly implied?" Come on, I ask you to run
> that interpretation by, well, anyone else in the world, including
> jwz.  He didn't say a single positive thing about C++! Where's the
> clear implication that "C++ is a good idea" in that?)

If he intended it to be a blanket comment on the utility of C++, why on
Earth did he qualify it?

I have to say I find the comment curious anyway - presumably he'd have
liked to have seen C in C++'s place. But anything I can write in C I can
write in C++ (with maybe a few extra casts). So that wasn't really what
he was getting at, I suppose. I presume he must not like the way it was
written. But what has that to do with C++? OK, C++ gives you more rope
to hang yourself with, but so what?

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|  Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author    http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Paul Phillips <pa...@go2net.com>.
[Sorry in advance for relative off-topicness.]

On Wed, 11 Mar 1998, Ben Laurie wrote:

> It is worth noting a couple of things here. First, he doesn't say that
> C++ in Mozilla was a bad idea, only that it was a bad idea in the cross
> platform stuff. Now, ask yourself what that means in the context of
> Mozilla. That's right! It means UI. We don't have any UI. So, what he
> didn't say, but clearly implied, was that C++ was a good idea everywhere
> else. Which is to say, in all the kind of code Apache is. 

I can tell you with extreme confidence that not only is he not talking
only about UI, but in *no way* is he implying that C++ was a good idea
everywhere else.  I've spoken with him about this specifically.  It's hard
to misinterpret "colossal cost."

> Another point he makes is that C++ may be object oriented, but that
> doesn't make people program it that way (or he may be making the point
> that C can be programmed in an object oriented way, but I assume not
> because that is true only in an academic sense).

He's saying that abstraction and encapsulation have a lot more to
do with the programmer than the programming language.  In other words,
he's saying both, but I see more of the one that you're assuming he's
not saying.

I hate to act as interpreter, but that was a pretty gross
misrepresentation ("clearly implied?" Come on, I ask you to run
that interpretation by, well, anyone else in the world, including
jwz.  He didn't say a single positive thing about C++! Where's the
clear implication that "C++ is a good idea" in that?)

-- 
Paul Phillips      | These pages look best if you come over and view them on
Cat Juggler        | my monitor.
<pa...@go2net.com> |     -- the essence of the modern web
+1 206 447 1595    |--------* http://www.go2net.com/people/paulp/ *--------


Re: the C++ disaster (was Re: Source code - optimised assembler)

Posted by Ben Laurie <be...@algroup.co.uk>.
Brian Behlendorf wrote:
> 
> feul for the fire.

It is worth noting a couple of things here. First, he doesn't say that
C++ in Mozilla was a bad idea, only that it was a bad idea in the cross
platform stuff. Now, ask yourself what that means in the context of
Mozilla. That's right! It means UI. We don't have any UI. So, what he
didn't say, but clearly implied, was that C++ was a good idea everywhere
else. Which is to say, in all the kind of code Apache is.

Another point he makes is that C++ may be object oriented, but that
doesn't make people program it that way (or he may be making the point
that C can be programmed in an object oriented way, but I assume not
because that is true only in an academic sense).

Cheers,

Ben.

> >G. Sumner Hayes wrote:
> >>
> >> Netscape chose C for some parts of the code and C++ for others, and
> >> while those may or may not be the best possible choices they're
> >> certainly reasonable ones.  They've dealt with the portability
> >> problems pretty well so far, and I presume they have a reasonable
> >> knowledge of available alternatives and the pros/cons of those.
> >
> >We have dealt with the portability problems, but at colossal cost.
> >
> >In my humble but correct opinion, it was a huge mistake to allow C++
> >code into the cross-platform areas of Mozilla.  Those who advocated
> >this underestimated the difficulty of the portability problems by
> >at least an order of magnitude.  But, what's done is done; that's
> >where we are today, and being able to say "I told you so" isn't much
> >of a reward.
> >
> >Hopefully, if we get anything out of this pyrrhic victory, at the
> >least we should be able to come up with a document that shows where
> >the land mines are buried, and that will perhaps convince others not
> >to run headlong into this same disaster in the future.
> >
> >It's too bad that most people don't get the fact that an object-oriented
> >programming style has exactly nothing to do with the programming
> >language you use.
> >
> >--
> >Jamie Zawinski         http://people.netscape.com/jwz/      about:jwz

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|  Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author    http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache