I've just uploaded a bug-fix version of NTL (version 7.0.2) at 
www.shoup.net/ntl.
Probably does not affect any Sage code, though.

Also, I'm getting closer to finish my quixotic quest to make NTL exception 
safe.
It is an interesting experience, as I'm learning how to make use of "modern"
C++ idioms to manage resources...so my code is no longer so archaic
in that respect.

As I get closer to finishing this, I'm thinking more about gmp's lack of 
proper error
handling, which is just like NTL's currently: print error message and call 
abort.

Have you Sage people developed any workarounds?
One idea I saw floating around on the Web: 
  - override gmp's allocation routines, keeping track
    of all extant gmp allocations
  - if out of mem, throw an exception
  - in any code calling gmp routines, use RAII to clean up
    any extant gmp allocations (this should be fairly lightweight)

I think that with gcc, one can compile C code so that one can safely
throw C++ exceptions through it.  -fexceptions, or something like that

This should work, but it makes some assumptions about gmp that I'm
not sure about:
   - gmp's mpn routines release all memory (NTL only uses mpn routines)
     between calls
   - there is no other global state in gmp that would
     be messed up by exceptions

Also, I know that there may be some other places in gmp where an error
might be raised, but I highly doubt that NTL would trigger any of these...
though I'm not 100% sure.  Ideally, gmp would provide a general
error callback routine that could throw an exception, as above.

I will also reach out to the gmp people on this, but I figured so Sage folks
must have thought about these issues already.

I hope to have an exception-safe version of NTL (modulo gmp exception 
safety)
ready within a few weeks.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to