[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: C++ exceptions
From:       Frans Englich <frans.englich () telia ! com>
Date:       2005-12-17 22:34:15
Message-ID: 200512172234.15490.frans.englich () telia ! com
[Download RAW message or body]

On Monday 05 December 2005 12:39, Allan Sandfeld Jensen wrote:
> On Sunday 04 December 2005 20:47, Jonas Widarsson wrote:
> > I've learned that there is some kind of decision made for KDE to not use
> > exceptions.
> >
> > I am working on two projects at the moment. One parser library that I
> > will use exceptions in, and one sound application that uses KDE and jack.
> >
> > I read about exceptions and like to use them in my KDE app to, but first
> > I'd like to hear the primary reasons why KDE didn't like exceptions.
>
> Because C++ exceptions are evil. They were a stupid design decision that
> wasn't thought out and not actually implemented until many years after
> their conception.
> They are as a result impossible to support for compilers without serious
> trade-offs in either space or speed. (either 20% slower or the need to
> included debug-info to unwind. Compiling with exceptions does the same as
> using -g1)
>
> The short lesson in every C++ book except Stroustrups is: Don't use them!

...if the performance difference turns out to be significant.

Java, C#, Python, etc, are partly popular because they make the programmer 
more productive, at the cost of CPU cycles. One language feature popular in 
those languages is exceptions. C++ is in general faster than Java et al, 
spending cycles on exceptions can apparently not be principally bad idea, if 
using Python or a similar language is in other cases considered wise.

Here's my advice: use exceptions where they design-wise make sense. If actual 
numbers(profiling) shows that exceptions is The performance bottle neck, 
first then go make the code less readable and unmaintainable.

Also, it wouldn't surprise me if GCC's acquirement of link-stage 
optimization/WPO(via LLVM, potentially) delivered massive improvement in this 
area by code flow analysis. Or is that theoretically impossible? (I know 
little about implementing C++/machine langauges.)


Cheers,

		Frans
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic