[M3devel] Do I remember well...

Jay jayk123 at hotmail.com
Mon Feb 25 09:50:08 CET 2008


This sounds very much how Windows has been but finally changed. 
 
 It used to be in C++ you could do: 
 
  try { printf("%s\n", (char*) 1); }  /* access violation, reading from address 1 */ 
  else catch (...) { printf("caught exception\n"); }  
 
  now you can't.  
  Now catch (...) catches all C++ exceptions but not these "Win32 structured exceptions".  
     "Win32 structured exceptions" are generally "hardware exceptions" made visible to software. 
     The most common one is an "access violation". There's also "stack overflow". And others.
     They can be raised by code via RaiseException though.
 
  There is a similar syntax for catching them -- __try / __except.  
 
  Now, maybe Modula-3 runtime errors are "more orderly" and so more "catchable"?
 In particular, Win32 structured exceptions fall into two or three classes:
    Someone called RaiseException. These are orderly and reasonable to catch, but rare. 
      (Even if C++ exceptions are implemented via RaiseException.) 
    Someone has some corrupted data and "access violated" (aka: some sort of signal/tap on Unix)  
    This is the more common case, and if you catch such an exception, you have to wonder, uh, some data is corrupt..which data? What can I possily do at this point, given that some data somewhere is corrupt? It could be the heap. It could be the stack. It could be something small that I'm not going to touch. Heck, maybe it was merely a NULL deref and nothing "very" corrupt. I suggest a NULL deref might be the third class, but not clear.
 
If Modula-3 does an adequate job of noticing things as soon as they have gone bad, and not at an indeterminate point afterward, that sounds more viable. I suspect this might be the case, as long as you haven't called out to some buggy C code or some unsafe Modula-3, oops.
 
What about integer overflow? I wonder. :)
 
   - Jay 



> To: dragisha at m3w.org> Date: Sun, 24 Feb 2008 14:24:30 -0800> From: mika at async.caltech.edu> CC: m3devel at elegosoft.com> Subject: Re: [M3devel] Do I remember well...> > Surely the SPIN people had to do that?> > I've wanted it a few times, too.> > Mika> > =?UTF-8?Q?Dragi=C5=A1a_Duri=C4=87?= writes:> >Once, there was a talk about (original?) CM3 making checked runtime> >errors behave like exceptions?> >-- > >Dragiša Durić <dragisha at m3w.org>
_________________________________________________________________
Connect and share in new ways with Windows Live.
http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20080225/86c95e24/attachment-0002.html>


More information about the M3devel mailing list