Re: Infinite Loops and Explicit Exits
From: Robert Wagner (spamblocker-robert_at_wagner.net)
Date: 11/16/04
- Next message: Robert Wagner: "Re: Infinite Loops and Explicit Exits"
- Previous message: Joe Zitzelberger: "Re: OT: demise of COBOL WAS: Infinite Loops and Explicit Exits"
- In reply to: Richard: "Re: Infinite Loops and Explicit Exits"
- Next in thread: Robert Wagner: "Re: Infinite Loops and Explicit Exits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 16 Nov 2004 06:05:39 GMT
On 15 Nov 2004 11:15:08 -0800, riplin@Azonic.co.nz (Richard) wrote:
>Robert Wagner <spamblocker-robert@wagner.net> wrote
>
>> The only hardware change was the addition of stack(s). Early
>> compilers, not having hardware stacks, created them by chain-linking
>> register save areas (for CALL) or putting return addresses into an
>> array (for PERFORM). The mechanics have changed but the principle
>> hasn't -- programs store a return address SOMEwhere.
>
>Yes, they do. And in machines of my experience that was in the EXIT
>statement placeholder at the end of the PERFORM range. Actually the
>particular compilers did not require an EXIT as it would always add
>nulops at the end of each paragraph and section. A PERFORM would be
>done by 1) setting return address at end of scope, 2) jumping to the
>start of scope, 3) clearing the return back to nulops.
>
>> Cobol was advertised to be machine-independent. It sounds odd to now
>> hear 'The hardware made us do it.'
>
>Cobol was/is 'machine independent', but to be that the language had to
>cater for how implementations would be done on different types of
>hardware. The EXIT in its own paragraph was part of the language
>_because_ that is where the PERFORM return was stored on some
>machines.
No. There has always been a need to cater to single-paragraph
PERFORMs. Poorly optimized early compilers generated conditional exit
code at the end of EVERY paragraph. Thus, PERFORM A THRU A-EXIT ran
slower than PERFORM A because of extra code at the end of A.
>In fact, even on stack based machines, code at the end of each
>paragraph need to check somehow whether it is the end of a perform
>scope or is to drop through. It can't just 'return to last item on
>stack' because this is where _some_ PERFORM might be done.
At least one compiler provided an option to do exactly that. By
selecting the option, you promised the compiler there were no
fall-thru paragraphs, such as the one before A-EXIT. I always used
that option on Realia.
- Next message: Robert Wagner: "Re: Infinite Loops and Explicit Exits"
- Previous message: Joe Zitzelberger: "Re: OT: demise of COBOL WAS: Infinite Loops and Explicit Exits"
- In reply to: Richard: "Re: Infinite Loops and Explicit Exits"
- Next in thread: Robert Wagner: "Re: Infinite Loops and Explicit Exits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|