Tom Lane wrote:
> This is not C.
I can't argue that; but it will compile on a C compiler on the Microsoft
platform. I'm not sure if you were answering tongue-in-cheek, so for
the benefit of the group:
__try and __except, as far as I can tell are the only way to gracefully
handle certain events. There is also a __finally. This is very much a
Microsoft hack to C and not C++.
GetExceptionCode() is from the win32 api.
In C++, you get to use the much more standard try/catch system.
Katie mentioned a while back using CWinApp from MFC for the windows
port. I advised against this based on it requiring a C++ compiler and
the MFC libs. However, if the win32 port is going that route maybe
introducing a little c++ exception handling might be the best solution
to the int/0 problem.
Barring that, it comes down to a choice of two not very pleasant
scenarios: either adopting the __try abomination or standardizing on
non-microsoft implementation of the C run time. You can forget using
anything from MFC in this case.
The only other solution is a #ifdef win32 around places that potentially
use integers in the divisor and do some nasty hacking. I would prefer
to use some type of signaling or 'exception' handling to that. The end
justifies the means, I suppose.
Merlin