× 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.



Jim wrote:
>Myself, I've used pointers just a few times, and the main thing I use them
>for is for trigger programs to correctly get the before and after image of
>the buffers without hardcoding a fixed offset.  Before pointers this was
>very hard to do and these programs would have a tendancy to stop working
>when IBM changed the layout of the return fields.
>
>The other things I've used pointers for I believe always had to do with
the
>API calls or some very low level reading of objects (one program to read
>NETF information directly in RPG).

When I said that I regret adding pointer datatype to the language,
perhaps "regret" was too strong a word.  Yes, there are some places
where pointers can be beneficial.  But my point is that pointers
should be used sparingly, and only when necessary.

>I do think, however, that if I start to implement programs in RPG using
>TCP/IP that I will be using pointers for that also to transverse the data
>buffer, although I've yet to find a real need to write a production RPG
>TCP/IP program.

TCP/IP programs probably should not be written in RPG.  And not just
because of it's poor pointer support.  Lack of proper thread support
in RPG is a big limiting factor in TCP programming.

>Personally, I find RPG pointer use easier to use than C pointer use and
less
>prone to mysterious errors.  The Based mechanism makes sense once I
>understood it and helps reduce the number of times I'm pointing a pointer
to
>a pointer instead of the data or such.

Pointer support in C is light-years better than in RPG for the
simple reason that pointers in C are strongly typed.  If you use the
wrong basing pointer, the C compiler will tell you immediately, and
save you the trouble of tracking down potentially nasty run-time
problems.  I would estimate that your development time can double
when using untyped pointers.

Since structures in RPG are untyped (always considered character
type), there was really little choice in the design of pointers in
the RPG IV language.

>I hate linked lists myself, and although I'm sure they have their place,
>I've always found some other mechanism to do what I wanted without having
to
>resort to them.

Me, I've always done well with pointers.  But then, I learned
about pointers in a strongly typed language, Pascal.

Cheers!  Hans


Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com



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.