SCOUG Logo


Next Meeting: Sat, TBD
Meeting Directions


Be a Member
Join SCOUG

Navigation:


Help with Searching

20 Most Recent Documents
Search Archives
Index by date, title, author, category.


Features:

Mr. Know-It-All
Ink
Download!










SCOUG:

Home

Email Lists

SIGs (Internet, General Interest, Programming, Network, more..)

Online Chats

Business

Past Presentations

Credits

Submissions

Contact SCOUG

Copyright SCOUG



warp expowest
Pictures from Sept. 1999

The views expressed in articles on this site are those of their authors.

warptech
SCOUG was there!


Copyright 1998-2024, 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.

The Southern California OS/2 User Group
USA

SCOUG-Programming Mailing List Archives

Return to [ 14 | February | 2004 ]

<< Previous Message << >> Next Message >>


Date: Sat, 14 Feb 2004 20:27:09 PST8
From: "Lynn H. Maxson" <lmaxson@pacbell.net >
Reply-To: scoug-programming@scoug.com
To: < "scoug-programming@scoug.com" > scoug-programming@scoug.com >
Subject: SCOUG-Programming: PL/I most important statement (was: call(TZ) ? - PL/I)

Content Type: text/plain

"...I am an engineer--I prefer Peter's approach. PL/I's
begin/end combination lets me think like an engineer. C's
malloc forces me to think like a programmer."

Oddly enough when I want to allocate space dynamically for a
matrix after I acquire the range in any dimension I use an
'allocate' statement, if for no other reason than that's what I
want to do. I would think an engineer would think like this.

On the other hand if you want to calculate the range of the
dimensions outside a begin-block, which you must do for them
to have a value on entry to it, you can. Then you must
create a begin-block, starting with a 'begin' statement, your
dynamic declare, the processing code, and finally the end
statement. Now that's thinking like a programmer.

In Peter's example he can't process more than one matrix at a
time. He certainly can't have them all present concurrently
unless they appear within the same begin-block. Why in a
virtual storage system he has this great concern about the
amount of (virtual) storage consumed is beyond me.

For most of us non-programmers who think in terms of what
we want to have happen when we no longer need a
dynamically allocated variable, we can 'free' it. We can do it
without any of the limitations imposed by a begin-block, i.e.
within a specific, non-shared code segment.

If you don't understand why in this instance the 'begin'
functions as an 'allocate' and the 'end' a 'free', then you must
think that there is some magic in the box. Otherwise you
know and control when it is allocated and when it is freed.
You know it in the same manner as if you used an 'allocate'
and 'free'. To say that an engineer somehow prefers one
form to the other does not hide the fact that in either case he
is programming its allocation and deallocation in the same
manner that any programmer would.

I can understand why Bob reacts the way he does. I'm almost
sorry that I even mentioned the two uses the PL/I authors had
in mind for the 'begin' statement. That Peter found a third
use to avoid an 'allocate' and 'free' while basically restricting
his processing options does not change the PL/I authors initial
intent.

Once more I invite Peter to use his method in the solution of
the Peg Solitaire problem. We will set aside an entire meeting
of the Programming SIG so that he can demonstrate the
elegance and simplicity of his approach. Actually I prefer he
write it in C which has no equivalent to the begin-block. I'm
sure he can find something else to use never intended to
provide that service.

The fact is I don't care. I understand how you can determine
at runtime the dimensions of a matrix, using that
determination in a dynamic allocation, which you can keep or
free at your leisure. You have the assurance that it
disappears on exiting the procedure. An 'allocate' and 'free'
tells the reader more explicitly what is occurring than hiding it
under the covers of a begin-block. I would think an engineer
would prefer more readable code. I know I would. Then
again I have this tendency to look beyond my needs.

=====================================================

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
"rollin@scoug.com".

=====================================================


<< Previous Message << >> Next Message >>

Return to [ 14 | February | 2004 ]



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.