SCOUG-Programming Mailing List Archives
Return to [ 18 |
April |
2005 ]
<< Previous Message <<
>> Next Message >>
Content Type: text/plain
"If I simply DCL a value or a record, I don't receive a pointer
-- the language hides that from me."
Blame it on a short term memory loss, but this one I forgot to
address earlier.
I don't know what's hidden here. If something is of no
interest, then why be bothered with it? If it is of interest,
then use the 'addr' builtin function. If you just need a place to
keep an address, then "dcl" an independent pointer (ptr)
variable.
That doesn't change the fact that both C and PL/I employ a
hierarchical qualification process for a variable: address
(location) and name. We need something of an example. We
will use a data structure.
dcl 1 struct1,
2 sub_struct1,
3 data1,
3 data2,
2 sub_struct2,
3 data1,
3 data2;
Of importance here are the variable names data1 and data2
which appear twice in the same declaration. Thus some
means must exist for the compiler to know which to process in
an assignment statement. Here name qualification is used:
using a higher level name to make the distinction.
To that end we would write sub_struct1.data1 to make it
distinct from sub_struct2.data1.
"data1" could in fact appear in multiple data structures, in
which case we would use the structure name, e.g.
struct1.sub_struct1.data1, to "name" qualify 'data1'. However,
as we will illustrate in list processing we can have the same
structure definition in mulitple places. Thus pure name
qualification will not work. That's why we use pointer (or
address) qualification: ptr ->name1.name2.name3.
Now if you can't do this, you can't do list processing...and you
can't have multiple instances of the same variable name
(element or aggregate). The 'based' storage attribute of PL/I
allows you to do both.
=====================================================
To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-programming".
For problems, contact the list owner at
"postmaster@scoug.com".
=====================================================
<< Previous Message <<
>> Next Message >>
Return to [ 18 |
April |
2005 ]
The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS
RESERVED.
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
|