This certainly seems like a reasonable behavior for an optimizing
compiler, but does the formal PL/I semantics demand the behavior you
have observed or is this just the current implementation behavior? If
this behavior is not formalized in language semantics, does that not
allow a more sophisticated optimizing compiler in the future to deduce
that copyright_text is expendable and ignore it? Maybe some languages
need a formal element attribute to say "useless but keep".
Joel C. Ewing
On 10/31/2013 12:55 PM, John Gilmore wrote:
> I wanted to test my notion before presenting it, and it does turn out
> that embedding an unreferenced value in a structure (COBOL record) at
> least one other element of which is referenced in an executable
> statement ensures that that structure will not be deleted.
>
> A PL/I example
>
> declare 1 copyright_block static,
> 2 false aligned bit initial('0'b),
> 2 true aligned bit initial('1'b),
> 2 copyright_text character(38) initial
> ('© copyright 1591 by John Harington, Kt') ;
>
> found = false ; /* ex hyothesii */
> linear_search: do i = lbound(A,1) to h bound(A,1) ;
> . . .
> found = (A(i) = s) ;
> if found then leave ; /* match? */
> . . .
> end linear_search ;
>
> Here the single reference to copyright_block.false in an executable
> statement ensures that the structure copyright_block will not be
> deleted (or trimmed) by an optimizing compiler.
>
> The same scheme is usable mutatis mutandis in IBM C/C++ and COBOL.
>
>
> John Gilmore, Ashland, MA 01721 - USA
>
--
Joel C. Ewing, Bentonville, AR [email protected]
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN