Re: exceptions with null pointers
 
Peter <peterf@xpedion.com> wrote:
int main()
{
  try{
    int* p = NULL;
    *p = 4;
  }
  catch(...){
     cout << "exception" << endl;
  }
  return 0;
}
if you work exclusively on Windows using the microsoft compilers,
you will get an exception.
Not true. C++ exception handling mechanism in Visual C++ is indeed based 
on "native" exception support provided by the operating system, called 
structured exception handling (SEH), or "C exceptions" (as they were 
introduced long time ago as an extension to C language). These are 
exceptions thrown by the operating system, eg. when invalid memory 
address is accessed, division by zero happens etc.. But there are number 
of optimizations that compiler applies to code when so called 
"synchronous exception handling mode" is set (which is default) and, 
unless you switch to "asynchronous exception handling mode", there is no 
warranty that catch (...) will actually catch any SEH exceptions. This 
is only visible in optimized builds, so whoever learn about the compiler 
mechanics only playing with debugger in Debug builds, probably never 
noticed it. It's documented in more detail here: 
http://msdn2.microsoft.com/en-us/library/5skw957f.aspx and 
http://msdn2.microsoft.com/en-US/library/1deeycx5.aspx
Also, in Visual C++ 2005 (msvc8) "synchronous exception mode" (default, 
as it is in older versions), catch(...) will not handle any SEH at all 
and will only catch C++ exceptions.
A exception is considerable more useful than a signal.
not really.
B.