Re: Throwing exception from _invalid_parameter_handler
- From: "Alex Fedotov" <me@xxxxxxxxxxxxxxx>
- Date: Wed, 14 Dec 2005 14:30:46 -0800
Doug Harrison [MVP] wrote:
I am wondering whether it is safe to throw a C++ exception from an invalid
parameter handler set with _set_invalid_parameter_handler. The documentation
mentions two actions the handler cat take: terminate the application or exit
silently. It doesn't explicitly mention throwing a C++ exception from the
handler function.
I'd think it's not OK to throw an exception, since the handler will be called from functions declared extern "C", which interacts with the usual /EHsc compiler option.
Well, that's a strong point. Let's assume for now that my code is compiled with /EHa. Can I still break anything inside the CRT if I throw an exception?
I would like to have invalid parameter handlers in place but I don't want to terminate the whole app if a buffer overflows, only the current work item. I wanted to avoid polluting my code with errno checking after every function call and throwing an exception seemed to be an elegant way of doing it.
Thanks,
-- Alex Fedotov
.
- Follow-Ups:
- Re: Throwing exception from _invalid_parameter_handler
- From: Doug Harrison [MVP]
- Re: Throwing exception from _invalid_parameter_handler
- From: Pavel Lebedinsky [MSFT]
- Re: Throwing exception from _invalid_parameter_handler
- References:
- Throwing exception from _invalid_parameter_handler
- From: Alex Fedotov
- Re: Throwing exception from _invalid_parameter_handler
- From: Doug Harrison [MVP]
- Throwing exception from _invalid_parameter_handler
- Prev by Date: __declspec(align(x)) and virtual tables
- Next by Date: Re: what is needed to implement a memory table?
- Previous by thread: Re: Throwing exception from _invalid_parameter_handler
- Next by thread: Re: Throwing exception from _invalid_parameter_handler
- Index(es):