[Cfp-interest] yet another look at floating-point try/catch for C

David Hough CFP pcfp at oakapple.net
Tue Jun 3 13:25:22 PDT 2014


Thinking again about
 1) desirability of "familiar" C++ try/catch syntax
 2) undesirability of disabling one-pass C compilation 
 3) undesirability of specifying the same thing twice 
 
I think we could take Ian's idea of a pre-specification and make it into 
an optional pragma: 
 
 
try { 
#pragma STDC FE_EXCEP_CATCH excep-list
 ... try code ...
}
catch_fe( e, excep-list) { 
 ... catch code ...
}
 
With the following understanding:   an implementation is encouraged to 
compile try/catch_fe whether or not every exception listed for catch_fe 
has a corresponding listing in a pragma in the try block, but is permitted     to give an error if a catch_fe exception was not listed in a corresponding  
pragma.      

The error is intended for one-pass compilers that want to implement 
the try block with operand and result or flag tests.
The pragma is intended to allow portable code among all conforming compilers,
no matter how they scan and implement try/catch.

I can't think offhand of anything exactly like that in C though. 
Any better ideas?



More information about the Cfp-interest mailing list