Topic: Static exception checking - 3rd try (was: Pure no-throw)


Author: iaugatwxe@x.com (iaugatwxe)
Date: Wed, 22 Sep 2004 17:12:55 GMT
Raw View
iaugatwxe wrote:

I changed my mind again, regarding the syntax (semantic is ok):

The following syntax wouldn't need the addition of any new keyword, so
it's probably preferable.


In the signatures, instead of:
   throw strict (A,B,C)
I now propose:
   throw static (A,B,C)

(where "static" recalls the "static checking of exceptions" of course)


In the blocks,

instead of:
   nothrow (B,C) { code here }
   nothrow (...) { code here }
I now propose
   throw !(B,C) { code here }  // "!" (not) is mandatory
   throw !(...) { code here }

instead of:
   throw strict { code here }
I now propose
   throw static { code here }


This adds zero new keywords to the language instead of the two of the
previous proposal.


Also there would be great benefit by using the idea of Alan Griffiths
(extern "nothrow" for C functions) in conjunction with my proposal. That
would probably be adapted like this:

in file <headerfile>  (the C++ header which is the wrapper for the C
header "<headerfile.h>") I would put something like (among the std
namespace etc...):

extern "C" "throwstatic()"
{
   #include<headerfile.h>
}
//All C functions declared without throw spec are now "throw static ()"



This mixes well with my proposal. Avoids a lot of tedious and
error-prone blocks like this around the calls to C functions:
   throw !(...)
   {
     throw static
     {
       c function calls here
     }
   }



39E29ECEAC92EA61CCA6061E7490921D8AAB3D0D

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]