Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Feb 2009 01:52:36 +0100
From:      cpghost <cpghost@cordula.ws>
To:        Marcel Moolenaar <xcllnt@mac.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: weeding out c++ keywords from sys/sys
Message-ID:  <20090216005236.GA1751@phenom.cordula.ws>
In-Reply-To: <8EF8771C-76D8-4556-96B2-B97B35573CBD@mac.com>
References:  <4995BB1B.7060201@icyb.net.ua> <20090213231513.GA20223@duncan.reilly.home> <4997F105.5020409@icyb.net.ua> <499811DF.6030905@incunabulum.net> <20090215151318.0d17bfb9@ernst.jennejohn.org> <499835BE.3000705@gmx.de> <8EF8771C-76D8-4556-96B2-B97B35573CBD@mac.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Feb 15, 2009 at 09:50:04AM -0800, Marcel Moolenaar wrote:
> On Feb 15, 2009, at 7:33 AM, Christoph Mallon wrote:
> > More robust error handling and less tedious resouce management  
> > directly come to mind:
> > Just look at normal C functions which allocate resources and have  
> > multiple points which can fail. They are the usual mess of if()s,  
> > goto error and lots of cleanup code. Further all this code looks  
> > pretty much the same in several modules. In C++ you write the  
> > resource handling code once (constructors/destructors) and then you  
> > cannot forget to clean up, because thanks to scoping and defined  
> > life ranges it happens automatically.
> 
> While on the surface this looks better, under the hood
> it's just the same. Worse in most likelihood, because
> with C the programmer writes the logic that is known to
> be needed (assuming no bugs). With C++ it's the compiler
> that generates code that handles all possible scenarios,
> and goes beyond what is strictly needed -- as such the
> cost tends to be higher, even when there are no errors
> or exceptions.
> 
> I'm not saying this is a problem. All I'm saying is that
> you move responsibility from the programmer to the compiler
> and in general this comes at a (runtime_ cost. One we may
> very well accept, mind you...

You just have to know how to use C++ properly and avoid
some constructs to create efficient code. Have a look at
L4::Pistachio for an example:

http://l4ka.org/projects/pistachio/

> Marcel Moolenaar
> xcllnt@mac.com

-cpghost.

-- 
Cordula's Web. http://www.cordula.ws/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090216005236.GA1751>