John,

maybe we should move this conversation to the PL/1 list;
I don't know if the people there follow the IBM main list, too.

I'll start by cross-posting this post there.

For those who didn't follow the previous post: I tried to translate
NULL() pointers to SYSNULL() pointers in a C routine; this failed because
of a compiler error in the z/OS C compiler (because the NULL() value
0xFF000000 has the high order bit set, which lead to serious trouble
in the translation logic I chose. I found a workaround, but the compiler
error still needs to be fixed).

a) I know about the ability to omit the parantheses when
having a builtin declaration; anyway, I always code the parantheses
to make sure that the compiler knows what I'm talking about. Call me paranoid ...
I simply don't know with large programs, if there are BUILTIN declarations
for NULL and SYSNULL ...

b) to have INIT structures in the include file, too, would indeed by an option.
But: many of our application people say, that the initialization

STRUCT = '';

is simple and understandable and should be implemented by the compiler
in an acceptable and performant way; this is just one of the strengths of
the PL/1 programming language: to have compact expressions for such
things like structure initialization.

That said: the initialization of pointers inside such structures with NULL() instead of SYSNULL() is an anachronism and there should probably be an option
to control this behaviour.

Kind regards

Bernd



Am 29.03.2014 13:03, schrieb John Gilmore:
Bernd,

Now that I have a better understanding of the full dimensions your
problem I will give it some further thought, and it may be that I will
be abe to make further suggestions.

In passing let me note that the usages

<whatever> = null() ;
<whatever> = sysnull() ;

are necessary and appropriate only in the absence of a declaration of the form

declare [sys]null builtin ;

When such a declaration is not present they make it clear to the
compiler that a BIF reference is meant.  (Neither null nor sysnull is
a PL/I keyword.)   When a declaration for the appropriate BIF is
provided the paired parentheses without argument can and should be
dispensed with; one of

<pointer reference> = null ;
<pointer reference> = sysnull ;

is sufficient.

In my own PL/I programming I avoid the construction

<structure> =  ''  ;

I prefer to define/generate and [perhaps only partially] initialize a
static structure the value of which can be assigned to instances of a
structure at any time.    For, say,

declare 1 cb based,  /* chaining block */
   2 fcp pointer,  /* forward chaining */
   2 bcp pointer,  /* back chaining */
   2 obp pointer ;  /* -> object */

I would write something like

declare 1 cb_anfänglich static,
   2 fcp pointer initial(sysnull),
   2 bcp pointer initial(sysnull),
   2 obp pointer initial(sysnull) ;
. . .
cbp->cb = cb_anfänglich ;

Schemes of this sort can be very largely automated; but they are not
of course suitable for old code, where introducing them would require
too many changes.

John Gilmore, Ashland, MA 01721 - USA

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to