POV-Ray : Newsgroups : povray.off-topic : Standard libraries : Re: Standard libraries Server Time
9 Oct 2024 14:33:54 EDT (-0400)
  Re: Standard libraries  
From: Nicolas Alvarez
Date: 8 Mar 2009 19:47:21
Message: <49b45909@news.povray.org>
Darren New wrote:
> Nicolas Alvarez wrote:
>> GNU libc (not libstdc++!) has C functions to get backtraces at any
>> moment. It's a GNU extension. You may very well call it in an exception
>> handler.
>> 
>> http://www.gnu.org/software/libtool/manual/libc/Backtraces.html
> 
> It would seem that's rather not very useful in the exception handler? Or
> am I misunderstanding?  If I catch a division-by-zero in main() and I want
> to log what function that happened in, how would I do that?

Uh... Actually you're right :)

I dunno... I think you might be able to do something like this:

template<typename E>
void my_throw_exception(E& exc) {
    //do the backtrace() dance and store the results somewhere in exc
    throw exc;
}

But that's a bit cumbersome.

(PS: Division by zero doesn't throw a C++ exception)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.