On Tue, Apr 04, 2006 at 10:25:15AM -0500, Bo Peng wrote:
> Dear list,
> 
> I get used to try/catch/throw for error handling and find it difficult
> to write code without them. What is the current coding rule regarding
> exception? If we are starting to use them, does it make sense to add a
> except.h and define all exceptions (such as lyx::err_empty_whatever)
> over there?

I use exceptions regularily but they seem to incur about the same amount
of problems as they solve. Moreover, used 'locally', they add a
significant amount of line noise to formerly compact code.

There are a few cases, where the advantages definitely outweigh the
disadvantages, although one of my favourite use cases ('keep an app 
running as long as possible by catching everything in the main 
eventloop') probably won't make it into LyX, as there the (semi-)
consensus is to crash and restart.

Writing really exception safe code is non-trivial and goes far beyond
sprinkling the code with 'catch', 'try', and 'throw'.

Andre'

Reply via email to