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

Jim Thomas jaswthomas at sbcglobal.net
Wed Feb 1 08:56:53 PST 2012


Please see comments below.

-Jim

On Jan 30, 2012, at 5:21 PM, David Hough CFP wrote:

> 
> 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.

Yes, assuming there was a local underflow flag.

>         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?

I was thinking of local flags at the higher level: they would appear to the program as being local. It would be up to the implementation to support the abstraction one way or another. Do we need a general local flag mechanism? Or would it be better to deal with local flags as the need arises within the context of alternate exception handling?

> 
> 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.

The (dynamic) FP environment, which includes the flags, is already thread-local in C99.


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




More information about the Cfp-interest mailing list