[Top][All Lists]

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

Re: C++

From: Bas Wijnen
Subject: Re: C++
Date: Fri, 25 Sep 2009 09:05:06 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Thu, Sep 24, 2009 at 02:24:28PM -0700, Jonathan S. Shapiro wrote:
> >>    I strongly side with bas here. Even if you hate so many things about
> >>    C++ (which I'm not going to argue about), the syntactic sugar for
> >>    non-fancy OOP (i.e. class and method structure, single inheritance)
> >>    is a sufficient reason to use C++ IMHO.
> >>
> >>  That is certainly a credible argument for application code.
> >>  For microkernel code, I can only tell you that we downgraded from C++
> >> back to C in Coyotos, and that doing so simultaneously reduced complexity
> >> and increased performance.
> >
> > That's interesting to hear. Any specific reasons? (When looking at the
> > pistachio source every now and then, I think I can somewhat imagine why.)
> Three reasons:
>    1. For the kernel, we were turning off many compiler/language features.
>    Most notably we turned of exception support, because the cost was high. At
>    some point we realized that we were building in G++ rather than C++. For
>    code that you want to assure, that is not allowed.
>    2. The bring-up complexity of the C++ library is considerable, and it is
>    even more tightly dependent on streams support than the C library. Since
>    EROS/Coyotos are not stream-oriented systems, that wasn't a good match.

For Iris I am not using such features, and I am certainly not using the
standard library (I wasn't using the standard C library for my previous
kernel either).  This however is no reason to not use member functions,
for example.  The resulting code may not be considered C++ by many, but
you do need a C++ compiler to build it.

>    3. Our ability to understand the code generation from C++ was noticeably
>    weaker than our ability to understand the code generation from C.

I don't think this is a problem for the limited set of features I use
either (at least I didn't have a problem with it while debugging using
the disassembly).

> So we dropped it for all of these reasons.

It sounds like you were using high-level features, and I can well
imagine that that didn't work well.  I don't think what I'm doing is a
problem.  (Compiling my code with a C++ compiler and using a few easy to
understand features, which really could have been done in C at the cost
of readability (but without any performance penalty or gain).)  If you
think this is a probem as well, please let me know why.


Attachment: signature.asc
Description: Digital signature

reply via email to

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