[Cfp-interest] Floating-point extensions for C report - part 1 - local flags

David Hough CFP pcfp at oakapple.net
Mon Jan 30 17:21:26 PST 2012


I am sorry to be so late to catch up with the excellent work done by the
active participants in CFP... I had several conflicts of other meetings with CFP
teleconferences.      I have been reviewing part 1 as it was
submitted to WG 14.

An open issue in 7.6.2 is

"Do we need to add support for local flags?"

I'm not quite sure exactly what that refers to, but I'd like to point out
that part of the idea of alternate exception handling could be thought
of in terms of local flags. Conceptually

# ON exception DO action
 ... block of code ...
# ON exception DO default

For a particular block of code, if a particular exception arises then
a non-default action is enabled.    There are various implementation mechanisms
for various alternate exception handlings.    The simplest example would
be abrupt underflow, where one might like a hardware static or dynamic mode
that to be enabled if there is one.    What if there is no such hardware
mode?     In that
and more general cases, if the exception is detected, something different
needs to happen.     But the first step is detecting the exception.
And you don't want to set the global exception flags if the exception is
being handled locally.    So one way of detecting the exception is by
clearing a local underflow flag and checking whether it has been raised at
opportune times within the block of code.         Is this what the open issue
in the report is getting at?     Is the need for an implementation 
mechanism or for a higher-level abstraction?

Of course there are other ways of detecting exceptions that
might be more suitable in a particular situation, such as trapping.

Or is the open question referring to what might be called 
"thread-local flags" in analogy to "thread-local storage".    Just as each
thread is supposed to have its local errno without interference with
other threads.    I thought that was part of the usual implementation of
threads already.
 


More information about the Cfp-interest mailing list