Re: try, finally

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

 



On Thu, Mar 20, 2008 at 7:10 PM, Jason Cipriani
<jason.cipriani@xxxxxxxxx> wrote:
>  It seems that the root of any disagreement is what kinds of errors
>  we'd prefer to represent with exceptions. You and Ted would use them
>  for rare, fatal error conditions, similar in spirit to machine
>  exceptions such as access violations and invalid instructions. I would
>  use them for more common errors such as invalid user input, missing
>  files, network errors, etc.

I would use them for network errors.  Depending upon why files may be
missing, I may or may not use them for that purpose.  I would
definitely not use them for invalid user input.

I suppose where I would draw the line is whether or not the system has
control over the inputs in question.  For example, if a file is
expected to exist because another system or a user is supposed to
create the file, exceptions shouldn't be used.

I will say, though, that this is how I use exceptions in C++.  I'm
much more lax with exception usage in languages like Python and
possibly Java (I don't have that much experience with Java, but I did
use exceptions for flow control in order to implement an ISO-8601
parser whose grammar seemed to require some lookahead, but I may just
have lacked the skills to eliminate this (mis)use of exceptions).

Noel

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux