Re: Books for advanced C++ debugging
On Jul 17, 8:01 pm, Joshua Maurice <joshuamaur...@gmail.com> wrote:
On Jul 17, 2:01 am, James Kanze <james.ka...@gmail.com> wrote:
On Jul 16, 11:34 pm, Joshua Maurice <joshuamaur...@gmail.com> wrote:
Or are we talking about how it's impossible to write
correct code in the face of asynchronous exceptions?
I'm not too sure what you mean here. As far as I know,
neither Java nor C++ support what I would call an
asynchronous exception. On the other hand, the fact that
you can't guarantee a function to never raise an exception
in Java does mean that you can't write really exception safe
code.
http://java.sun.com/docs/books/jls/first_edition/html/11.doc.html
details asynchronous exceptions.
OK. It's true that things like internal errors in the virtual
machine would be asynchronously. (The C++ standard says nothing
about what happens when there is a problem in the execution
platform, so it's undefined behavior. In practice, of course,
regardless of what the language specification says, if the
execution platform doesn't work correctly, you can forget the
language standard.) The case of Thread.stop() is a special
case; they've explicitly provided a means of creating an
asynchronous exception in another thread. Current C++ doesn't
recognize threads, but I don't think that the next version
(which does support threading) will have anything similar. (The
current Java specification deprecates Thread.stop().)
I haven't thought it through thoroughly enough, but at the
very least it would be in practice impossible to write correct
code in the face of asynchronous exceptions, and may be
in-fact impossible to write it. Depends on exactly what they
call "a transfer of control" and "statements" in regards to
when an asynchronous exception can be raised. However, this is
getting a little off topic, so I guess I'll leave it at that.
Writing exception safe code is on topic, and the nothrow
guarantee for a few, primitive functions is necessary in order
to do so.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34