× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



>From: John Taylor [mailto:jtaylor@rpg2java.com]
>Like providing functions that allow you to increase/decrease the allocated
size at a given offset,

OK, I've used pointer-based languages for many years and I've never wanted
to allocate more memory in the middle of an allocation. Maybe that just
because I couldn't so my brain doesn't work that way, but why would you want
to do such a thing? Are you planning on having the allocation work like a
linked list where you're inserting a new element in the middle of the list?

-Walden

------------
Walden H Leverich III
President
Tech Software
(516) 627-3800 x11
(208) 692-3308 eFax
WaldenL@TechSoftInc.com
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)



-----Original Message-----
From: John Taylor [mailto:jtaylor@rpg2java.com]
Sent: Tuesday, April 09, 2002 10:54
To: mi400@midrange.com
Subject: Re: [MI400] Space pointers


Hi Simon,

> Given that you said "I'm building a service program (in RPG) with the
> intent of simplying the use of dynamic heap storage."
>
> I honestly can't see anything simpler than the supplied RPG IV
> op-codes:
>
> ALLOC
> REALLOC
> DEALLOC

You're right, it doesn't get any simpler than that. I just did a poor job of
explaining what I'm trying to achieve. The xxALLOC opcodes are very easy to
use but, as with much of RPG, their implementation is a bit quirky. For
example:

- ALLOC doesn't provide an option to initialize the storage during
allocation. This makes for some interesting bugs if the programmer reads
back more data than he wrote to the heap.

- DEALLOC forces you to remember to add the  (N) opcode extender in order to
automatically set the pointer to NULL. At the very least, shouldn't this
have been the default? After all, why would you let a programmer maintain a
valid pointer to heap storage that you've just freed? Maybe there's a good
reason for it, but I've yet to run across it.

- Error reporting is very primitive. Status 426 - error in storage
management operation, is not exactly informative.

Those are some of the basic "clean-up" improvements, but the main purpose of
the service program is to extend the existing functionality. Like providing
functions that allow you to increase/decrease the allocated size at a given
offset, instead of simply extending/truncating storage from the end.


> You also said:
>
> >This is only good for the default (ILE) heap.
>

Yes, as part of my explanation of RPG's intrinsic support. The xxALLOC
opcodes are limited to the default heap.

> IBM provide a set of ILE storage management APIs that let you define
> you own heap and control the allocation strategy.
>

Yes, those are the ones I'm using in the service program. In fact, I'm
pretty certain that they're the ones used by the RPG compiler as well.

Thanks for the feedback.


John Taylor




_______________________________________________
This is the MI Programming on the AS400 / iSeries (MI400) mailing list To
post a message email: MI400@midrange.com To subscribe, unsubscribe, or
change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/mi400
or email: MI400-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/mi400.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.