<html><body>
<p><font size="2" face="sans-serif">Yes, please omit &quot;unconventional&quot;. &nbsp;The PowerPC branches are different from some others in that each tests some bit in a conditional register, but that's not really unconventional. &nbsp;More importantly, the standard branch instructions that handle standard compares that set the condition register also handle floating-point exception testing, because first a status bit is copied from the Floating-Point Status and Control Register to the condition register.</font><br>
<br>
<font size="2" face="sans-serif">- Ian McIntosh &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IBM Canada Lab &nbsp; &nbsp; &nbsp; &nbsp; Compiler Back End Support and Development<br>
</font><br>
<br>
<img width="16" height="16" src="cid:1__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt="Inactive hide details for Jim Thomas ---2014-06-06 08:05:23 PM---On Jun 6, 2014, at 4:25 PM, David Hough CFP &lt;pcfp@oakapple.net"><font size="2" color="#424282" face="sans-serif">Jim Thomas ---2014-06-06 08:05:23 PM---On Jun 6, 2014, at 4:25 PM, David Hough CFP &lt;pcfp@oakapple.net&gt; wrote: &gt; Here are some revisions bas</font><br>
<br>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>

<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">From:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">Jim Thomas &lt;jaswthomas@sbcglobal.net&gt;</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>

<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">To:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">David Hough CFP &lt;pcfp@oakapple.net&gt;, </font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>

<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Cc:</font></ul>
</td><td width="100%" valign="middle"><img width="1" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">CFP &lt;cfp-interest@ucbtest.org&gt;</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>

<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Date:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">2014-06-06 08:05 PM</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>

<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Subject:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">Re: [Cfp-interest] draft of syntax discussion for C committee</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>

<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Sent by:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF663DF80BFFA8f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">cfp-interest-bounces@oakapple.net</font></td></tr>
</table>
<hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br>
<br>
<br>
<tt><font size="2"><br>
On Jun 6, 2014, at 4:25 PM, David Hough CFP &lt;pcfp@oakapple.net&gt; wrote:<br>
<br>
&gt; Here are some revisions based on Jim's comments, along with responses<br>
&gt; on some of the comments:<br>
&gt; <br>
&gt; =========================================<br>
&gt; <br>
&gt; DIFF: 36,37c36,44<br>
&gt; <br>
&gt; &lt; traps, but with significant performance penalties for either the normal case <br>
&gt; &lt; or exceptional case.<br>
&gt; ---<br>
&gt;&gt; traps, but that might entail significant performance penalties for either <br>
&gt;&gt; the normal case or exceptional case. &nbsp; &nbsp; Exceptions can be detected<br>
&gt;&gt; inline for each operation with tests on operands and results and flags -<br>
&gt;&gt; slowing down the normal case - or at the end of the try clause with flags -<br>
&gt;&gt; slowing the detection of the exceptional case (but testing flags alone does<br>
&gt;&gt; not detect exact underflow exceptions). &nbsp; &nbsp;Instead of traps,<br>
&gt;&gt; some existing hardware such as<br>
&gt;&gt; PowerPC can exploit its unconventional conditional branch instructions <br>
&gt;&gt; to detect exceptions.<br>
<br>
Consider omitting &#8220;unconventional&#8221;.<br>
<br>
&gt; <br>
&gt; COMMENT:<br>
&gt; <br>
&gt; [<br>
&gt;&gt; Is how to implement alternate exception handling without traps <br>
&gt;&gt; (including for underflow) documented somewhere?<br>
&gt; <br>
&gt; Not that I know of - the general idea is mentioned here; how that works out<br>
&gt; in detailed code generation depends on the hardware architecture, but we<br>
&gt; could write up some hints that look like C code - <br>
&gt; but I don't think this document is the place for it.<br>
<br>
Right, this isn&#8217;t the place for such details. (I&#8217;m still wondering if some HW might not provide any way for a program to detect underflow exceptions.)<br>
<br>
&gt; ]<br>
&gt; <br>
&gt; =========================================<br>
&gt; <br>
&gt; DIFF: 150,151c157,160<br>
&gt; <br>
&gt; &lt; But having to specify the same exception-list in two different places<br>
&gt; &lt; seems error-prone.<br>
&gt; ---<br>
&gt;&gt; Compilers that would process the catch_fe clauses before generating the<br>
&gt;&gt; try clause code could ignore that pragma.<br>
&gt;&gt; One-pass compilers that encountered discrepancies in catch_fe clauses <br>
&gt;&gt; from the exceptions flagged in advance should probably generate errors.<br>
&gt; <br>
&gt; COMMENT:<br>
&gt; <br>
&gt; [<br>
&gt;&gt; It doesn't need to be error prone. The CATCH_AHEAD exception list could be required to be a super set of all the catch_fe exception lists, which the compiler could check. The advantages would be a concise statement of exceptions that might get alternate exception handling and not having to see all the exception code before getting to the main code - which I believe would make the code more readable.<br>
&gt; <br>
&gt; Actually the simplest method for doing what Jim proposes without duplicating<br>
&gt; effort might be like this:<br>
&gt; <br>
&gt; {<br>
&gt; #pragma STDC catch_fe fe_exception1 label1<br>
&gt; #pragma STDC catch_fe fe_exception2 label2<br>
&gt; &nbsp;... normal case code<br>
&gt; }<br>
&gt; &nbsp;... normal case continues here<br>
&gt; label1:<br>
&gt; &nbsp;... exception case 1 code<br>
&gt; label2:<br>
&gt; &nbsp;... exception case 2 code<br>
&gt; <br>
&gt; You don't need exception lists any more - list one exception at a time<br>
&gt; even if they both go to the same place.<br>
&gt; The above is entirely freed from block structure... or not:<br>
&gt; <br>
&gt; {<br>
&gt; #pragma STDC catch_fe fe_exception1 label1<br>
&gt; #pragma STDC catch_fe fe_exception2 label2<br>
&gt; &nbsp;... normal case code<br>
&gt; &nbsp;break;<br>
&gt; label1:<br>
&gt; &nbsp;... exception case 1 code<br>
&gt; label2:<br>
&gt; &nbsp;... exception case 2 code<br>
&gt; }<br>
&gt; ... normal case continues here<br>
&gt; <br>
&gt; Putting it into C++ try/catch form requires a way of creating a type<br>
&gt; from an exception name:<br>
&gt; <br>
&gt; try {<br>
&gt; #pragma STDC catch_fe fe_exception1<br>
&gt; #pragma STDC catch_fe fe_exception2<br>
&gt; &nbsp;... normal case code<br>
&gt; }<br>
&gt; catch (FE_EXCEPTION_TYPE(fp_exception1) e1) {<br>
&gt; &nbsp;... exception case 1 code<br>
&gt; }<br>
&gt; catch (FE_EXCEPTION_TYPE(fp_exception2) e2) {<br>
&gt; &nbsp;... exception case 2 code<br>
&gt; }<br>
&gt; ... normal case continues here<br>
&gt; <br>
&gt; FE_EXCEPTION_TYPE is a standard macro that converts an &lt;fenv.h&gt; exception<br>
&gt; like FE_INVALID (which is just an implementation-defined integer <br>
&gt; representing a bit in a field) into a type FE_INVALID_TYPE,<br>
&gt; since C++ style catch works on the type of its argument.<br>
&gt; Whatever is actually in the variable e1 or e2 doesn't matter because it's<br>
&gt; not likely to be in a form useful in a portable program.<br>
&gt; <br>
&gt; I don't regard defining FE_EXCEPTION_TYPE <br>
&gt; as doing the application programmer any favor.<br>
&gt; I'd much rather write<br>
&gt; catch_fe(fp_exception1)<br>
&gt; than <br>
&gt; catch (FE_EXCEPTION_TYPE(fp_exception1) e1)<br>
&gt; <br>
&gt; The point is that it could be made to look more or less like C++<br>
&gt; if that were deemed important enough.<br>
&gt; ]<br>
&gt; <br>
&gt; =========================================<br>
&gt; <br>
&gt; DIFF: 156,160c164,168<br>
&gt; <br>
&gt; &lt; exception handling could be added to C++ with minimal syntactic <br>
&gt; &lt; effort, and most of<br>
&gt; &lt; C++ exception handling could be added to C with minimal syntactic <br>
&gt; &lt; effort.<br>
&gt; &lt; If that compatibility is deemed to be of low value, <br>
&gt; ---<br>
&gt;&gt; exception handling could be added to C++ with less syntactic <br>
&gt;&gt; effort than other possible approaches, and most of<br>
&gt;&gt; C++ exception handling could be added to C with less syntactic <br>
&gt;&gt; effort than other possible approaches.<br>
&gt;&gt; If that compatibility were deemed to cost more than its benefit,<br>
<br>
The pragma approach adds nothing to the syntax of the language.<br>
<br>
&gt; <br>
&gt; COMMENT:<br>
&gt; <br>
&gt; [<br>
&gt;&gt;&gt; One result of preserving some form of try/catch syntax is that <br>
&gt;&gt;&gt; floating-point<br>
&gt;&gt;&gt; exception handling could be added to C++ with minimal syntactic effort, <br>
&gt; <br>
&gt;&gt; Is this true? Has it been done?<br>
&gt; <br>
&gt;&gt;&gt; and most of<br>
&gt;&gt;&gt; C++ exception handling could be added to C with minimal syntactic effort.<br>
&gt; <br>
&gt;&gt; Really? We don't have a specification of the changes to C required to add such syntax.<br>
&gt; <br>
&gt; Neither of these has been done.<br>
&gt; But they would require minimal syntactic effort <br>
&gt; compared to a completely different syntax. &nbsp; &nbsp; <br>
<br>
See previous comment.<br>
<br>
&gt; That doesn't address the effort to implement the semantics.<br>
&gt; ]<br>
&gt; <br>
&gt; [<br>
&gt;&gt;&gt; If that compatibility is deemed to be of low value<br>
&gt; <br>
&gt;&gt; Not a fair statement. C and C++ compatibility is certainly of value, and it might be regarded as a reasons for not adding a different specialized try-catch.<br>
&gt; <br>
&gt; I should have used the subjunctive here - I really don't know if there is<br>
&gt; consensus one way or another on the C committee on this point.<br>
&gt; ]<br>
&gt; <br>
<br>
<br>
_______________________________________________<br>
Cfp-interest mailing list<br>
Cfp-interest@oakapple.net<br>
</font></tt><tt><font size="2"><a href="http://mailman.oakapple.net/mailman/listinfo/cfp-interest">http://mailman.oakapple.net/mailman/listinfo/cfp-interest</a></font></tt><tt><font size="2"><br>
<br>
</font></tt><br>
<br>
</body></html>