[Cfp-interest] exceptional macro
Jim Thomas
jaswthomas at sbcglobal.net
Mon May 19 10:46:34 PDT 2014
I’m worrying about use of compound statements as a macro argument. There’s a discussion about this at
http://stackoverflow.com/questions/17182877/is-it-ok-to-use-a-code-block-as-an-argument-for-a-c-macro
How serious is the restriction on the use of unguarded commas? E.g., how would multidimensional arrays be expressed? Are there other restrictions?
-Jim
On May 14, 2014, at 2:01 AM, Mike Cowlishaw <mfc at speleotrove.com> wrote:
>
>> 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/20140519/50d2565f/attachment.html
More information about the Cfp-interest
mailing list