Scope of application of pragma OPTIMIZE 84-10-01 AI-00116/01 1 | !standard B (08) 84-10-01 AI-00116/01 | !class binding interpretation 83-11-07 (provisional classification) !status received 83-11-07 !topic Scope of application of pragma OPTIMIZE !abstract 83-11-07 !recommendation 83-11-07 !wording 83-11-07 !discussion 83-11-07 | !appendix 84-10-01 | | ****************************************************************************** !section B (08) Pepperdine/Norsk Data/Ada-Europe 83-05-183-00168 !version 1983 !topic Scope of application of pragma OPTIMIZE It is not clear what the scope of the pragma OPTIMIZE is. It seems clear that the intention is to restrict the scope to the innermost block which encloses the declarative part in which the pragma appears; but it is far from clear whether it is intended to include blocks contained within this containing block. If it does apply to the inner blocks, then there is a problem in implementations which generate output from blocks as soon as they have been parsed, and consequently the pragma cannot be applied retrospectively to bodies that appear in the same declarative region as, but prior to, the pragma. Our implementation will restrict the pragma to the innermost enclosing block, and those blocks contained within it which also occur after the pragma. It will also apply to the bodies of separate units whose stubs appear after the pragma in the enclosing declarative region. If there is more than one OPTIMIZE pragma in a given declarative region, then we will assume that the language leaves indeterminate which will apply to each part of the block or inner blocks. RESPONSE Inner blocks are parts of a block, so the pragma applies to them too. If it is intended to apply the pragma to a subprogram body in the same declarative part, then the pragma should clearly precede that body. The pragma should be repeated in the declarative part of the proper body of a subunit, since the subunit is not part of the block that contains the stub. Scope of application of pragma OPTIMIZE 84-10-01 AI-00116/01 2 | ****************************************************************************** | | !section B (08) Peter Belmnt 84-09-21 83-00421 | !version 1983 | !topic Scope of application of pragma OPTIMIZE | !reference 83-00168 | | The response to the referenced item states that | inner blocks are parts of a containing block | stubs are parts of a containing block | but subunits are NOT part of the block that contains | the corresponding stub. | | It judges that, therefor, that the scope of pragma OPTIMIZE | does not pass transitively down to subunits. | | This means that the act of restructuring a program via subunits | will change the way the compiler deals with the program. And this | is contrary to an old Ada design principle, as I understand it. | | I have two quesetions. | | (1) What is the authority or argument for this exclusion of subunits | from the block or body containing the corresponding stub; | | (2) What is the authority for excluding the portion of a block | or body from the scope of appliocation of this pragma | which precedes the pragma textually? The RESPONSE says | "... then the pragma should clerly precede that body ..." whereas the LRM | says: ".. applies to the blkock or body enclosing ...[the pragma] ..."