[Cfp-interest] exceptional macro

Rajan Bhakta rbhakta at us.ibm.com
Wed May 14 05:27:56 PDT 2014


Just to make sure we're all on the same page after your correction, we 
also have to move the parenthesis right?

i.e. 
Rather than having the multiple arguments, perhaps it could be simply

  FE_EXCEPTIONS( expression )

which returns the exceptions raised in the evaluation of the expression 
(or
compound statement if that's allowed), ORed together.  (Assuming the 
exceptions
& subexpressions are defined to be bit-unique.) 


Then one might write:

  if (FE_EXCEPTIONS( p/q ) & (FE_UNDERFLOW | FE_INVALID | ...)) {whatever}

or

  x = (FE_EXCEPTIONS( p/q ) & (FE_UNDERFLOW | FE_INVALID | ...)) ? a : 
sNAN ;

etc.
Regards,

Rajan Bhakta
z/OS XL C/C++ Compiler Technical Architect
ISO C Standards Representative for Canada
C Compiler Development
Contact: rbhakta at us.ibm.com, Rajan Bhakta/Houston/IBM



From:   "Mike Cowlishaw" <mfc at speleotrove.com>
To:     "'David Hough CFP'" <pcfp at oakapple.net>, 
<cfp-interest at ucbtest.org>, 
Date:   05/14/2014 06:02 AM
Subject:        Re: [Cfp-interest] exceptional macro
Sent by:        cfp-interest-bounces at oakapple.net



 
>  FE_EXCEPTIONAL( expression or compound statement, 
>                  exception1, exception2, ...)

Rather than having the multiple arguments, perhaps it could be simply

  FE_EXCEPTIONS( expression )

which returns the exceptions raised in the evaluation of the expression 
(or
compound statement if that's allowed), ORed together.  (Assuming the 
exceptions
& subexpressions are defined to be bit-unique.) 


Then one might write:

  if (FE_EXCEPTIONS( p/q | FE_UNDERFLOW )) {whatever}

or

  x = FE_EXCEPTIONS( a=p/q | FE_UNDERFLOW ) ? a : sNAN ;

etc.

Mike

_______________________________________________
Cfp-interest mailing list
Cfp-interest at oakapple.net
http://mailman.oakapple.net/mailman/listinfo/cfp-interest


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20140514/7eba51db/attachment.html 


More information about the Cfp-interest mailing list