[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ON EXCEPTION and STATIC CALL being mutually exclusive (was: The next que
From: |
Simon Sobisch |
Subject: |
ON EXCEPTION and STATIC CALL being mutually exclusive (was: The next question) |
Date: |
Sun, 22 Mar 2020 11:06:37 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
Am 22.03.2020 um 09:53 schrieb Brian Tiffin:
> [...]
> CALL "subprog"
>
> is a dynamic lookup, and requires a library search path at run-time.
> LD_LIBRARY_PATH and friends. The ON EXCEPTION phrase of CALL can be
> used to test for not found.
>
> CALL "subprog" ON EXCEPTION DISPLAY "no linkage to subprog" END-CALL
>
> CALL STATIC "subprog"
>
> includes the object code in the binary, so no need for run-time
> searching, and no chance of firing an ON EXCEPTION clause. We actually
> made that an error, and I'm protesting... it should be a warning,
> otherwise you need to gut a lot more code to run quick tests between
> STATIC and normal CALL, and so what if the exception never fires (while
> developing).
That is a very valid point. Another one is that cobc will ignore a
static call convention flag if there's an ON EXCEPTION clause like
CALL my-convention "some" ON EXCEPTION DISPLAY "can't find the module"
or
>> CALL-CONVENTION STATIC
CALL "some" ON EXCEPTION DISPLAY "can't find the module"
with a report to the programmer
prog.cob:6: warning: STATIC CALL convention ignored because of ON
EXCEPTION
So instead of raising an error
CALL STATIC "some" ON EXCEPTION DISPLAY "can't find the module"
as
prog.cob:5: error: STATIC CALL and ON EXCEPTION are mutually exclusive
the 3.1 release will say
prog.cob:5: warning: ON EXCEPTION ignored because of STATIC CALL
Checked in with r3506, will be merged to trunk later (there will be some
minor merging before the 3.1rc in any case).
Simon