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



This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
The User space API's are an excellent reason for pointers.  The code is
actually MORE maintainable with pointers than with the repetitious calls
to QUSRTVUS.

Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin




Joel Fritz <JFritz@sharperimage.com>
Sent by: rpg400-l-admin@midrange.com
11/21/2002 12:12 PM
Please respond to rpg400-l

        To:     "'rpg400-l@midrange.com'" <rpg400-l@midrange.com>
        cc:
        Fax to:
        Subject:        RE: CL pgm and pointer variables


I was trained as a C programmer, although I haven't used it in almost ten
years.  Pointers are necessary in C because there's no passing by
reference,
for support of dynamic memory allocation, and the way that arrays are
defined.  There's a lot of cool things you can do with pointers like
direct
access to hardware if the OS permits it.  By allocating memory to a
void--typeless--pointer and then type casting it, you can do darned near
anything, just like an RPG pointer.   It's interesting that one of the
features of C++ is reference variables.

IMHO, there is very little need for pointers in business application
programming in RPG.  There are some situations where dynamic memory
allocation makes sense, and you may need them for some API calls.  Mind
you,
I'm willing to sacrifice some performance for maintainability.  I think
they're nice to have, but should be used when they're the only reasonable
option for solving a problem.


> -----Original Message-----
> From: Hans Boldt [mailto:boldt@ca.ibm.com]
> Sent: Thursday, November 21, 2002 7:26 AM
> To: rpg400-l@midrange.com
> Subject: Re: CL pgm and pointer variables
>
>
> Booth wrote:
>  > Wouldn't an even easier solution to these inherent
>  > problems with pointers be to just not use pointers?
>
> To which Rob answered:
> > Wouldn't an easy solution to divide-by-zero errors
>  > be to just not use division?
>
> Yes, that would in fact be acceptable. As those who've used division
> in RPG expressions have learned (sometimes the hard way), it is
> sometimes best to avoid division in expressions if at all possible.
>
> ;-)
>
> I do see your point, though. Why avoid something just because it is
> potentially troublesome? The difference here is that when you have a
> problem with division, you can normally easily locate the bug to the
> appropriate expression.
>
> On the other hand, pointer bugs can often be very difficult to trace
> down. For example, let's say you DEALLOC some piece of storage, but
> somewhere else you still have a pointer pointing at that piece of
> storage. Since that storage may then be returned on subsequent
> %ALLOC operations, unpredictable results can happen when accessing
> data through the original pointer, or worse, when the storage is
> changed using the original pointer. Even worse, the problems can
> often *seem* to disappear just by changing one seemingly unrelated
> thing.
>
> I can attest to the problems you can have with pointers from my own
> experience with the ILE RPG compiler, and that's using a language
> with strong type checking of pointers! With untyped pointers (as in
> RPG), the potential problems are much worse. At first glance,
> debugging pointer problems can seem unsurmountable. Even at second
> or third glance!
>
> Cheers!  Hans
>
>
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
> mailing list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
NOTICE:
All e-mail sent to or from this e-mail address will be received or
otherwise
recorded by The Sharper Image corporate e-mail system and is subject to
archival, monitoring, review by and/or disclosure to Sharper Image
security
and other management. This message is intended only for the use of the
addressee and may contain information that is privileged and confidential.
The contents of this message may contain personal views which are not the
views of The Sharper Image. If you are not the intended recipient,
dissemination of this communication is prohibited.
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.