[Cfp-interest] order of declaration in C

Rajan Bhakta rbhakta at us.ibm.com
Mon Jun 2 05:33:29 PDT 2014


I know of at least 4 compilers that do not do look ahead (beyond a token 
or two), and are single pass.

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:   David Hough CFP <pcfp at oakapple.net>
To:     cfp-interest at ucbtest.org, 
Date:   05/30/2014 04:35 PM
Subject:        [Cfp-interest] order of declaration in C
Sent by:        cfp-interest-bounces at oakapple.net




One of the possible problems of try/catch is that
the list of floating-point exceptions to be caught comes after the 
code that must be compiled knowing about them.   So that implies some sort
of lookahead to see what catches follow a try block before compiling it.
Note that if catches are to be implemented with traps, the trap enables
could be embodied in preamble and postambles 
that are compiled after the try and
catches are compiled, but executed before and after the try.    However
if the catches are to be implemented by checking flags within the try 
block, 
those flag checks should be inserted in the code for the try block.
If the flag checkes are implemented at the end of the try block, then
it becomes a preamble/postamble situation again.    However we really
want to encourage compilers to detect exceptions as soon as possible
because continuing execution with a bunch of NaNs or subnormals might
get very expensive - only to be thrown away anyway.

My question is:   is there anything else in C that requires such lookahead
in order to generate code?
Is this a big enough deal to worry about?

Ian proposes declaring the exceptions of interest in advance, but I figure
if you're going to do that, you might as well declare the exception
handling in advance too, so it's all in one place.     Maybe something 
like

Instead of conventional,

try {
normal code
}
catch_fe(e, elist) {
exceptional code
}

suppose the syntax for catch_fe is more like:

try {
catch_fe(e, elist) {
exceptional code
}
normal code
}

I'm sure that will bother anybody used to conventional try/catch.


_______________________________________________
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/20140602/88593eed/attachment.html 


More information about the Cfp-interest mailing list