|
If we didn't have pointers in RPG IV, it would be so difficult to call the various C runtime library functions that we've been exploiting. I agree that if people fall into a groove of using pointers for things like link lists, that is going too far, and an array, or multiple occurrence data structure might be safer. Bob Cozzi cozzi@rpgiv.com Visit the on-line Midrange Developer forum at: http://www.rpgiv.com > -----Original Message----- > From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com] On > Behalf Of Mel Rothman > Sent: Friday, January 11, 2002 5:32 PM > To: rpg400-l@midrange.com > Subject: Re: Adding pointers to RPG language. > > I think we are more in agreement than not. > > Yes, RPG pointer support is nothing like C pointer support. However, I was > commenting about no pointer support versus what has been implemented. If the > RPG IV compiler team were to implement additional pointer support, it would > make my day! :-) > > Regarding pointers being overused, I can comment only for myself, and I plead > "not guilty." I use them to accomplish what can't be accomplished nearly as > easily in other ways or when they give me significant performance advantages > over the alternatives. > > I agree that many RPG programmers have trouble with pointers, as do many C, > Pascal, etc. programmers. Pointers are tools, like any other. The user has > to learn how to use them properly or suffer the consequences. Programmers > that find pointers beyond their grasp, can and should, as you said, choose not > to use them. > > I still think the pointer we have today was a very good idea and thank you > very much for whatever part you played in bringing it to us. > > Cheers, > > Mel Rothman > IBM eServer Custom Technology Center (eCTC), Rochester, Minnesota > http://www-1.ibm.com/servers/eserver/iseries/service/ctc/ > > > Hans Boldt wrote: > > > > Mel wrote: > > >Hans, I don't think "adding pointers to the language was a bad idea." > > > > > >You should be taking credit, not blame, for adding them. > > > > > >Many things that would be difficult or impossible to do without pointers > > >are relatively easy to do with them. For example: dynamically allocated > > >storage, using many system APIs and C functions, navigating complex > > >structures, handling blocks of data larger than 32767 bytes, etc. > > > > Two points: > > > > First, RPG pointer support is nothing like pointers in, say, C. In > > C, pointers are typed, and so the compiler can complain about type > > mismatches, which can save lots of potential headaches. Pointers in > > RPG are untyped. It's a lot more difficult to debug pointer problems > > in RPG than in C. (And C is hard enough as it is sometimes!) > > > > Second, I believe pointers may well be overused in RPG. Sure, > > they're great when you have to call some API. But beyond that, I > > wonder if they're being used just because they might offer some > > "cool", "geeky" way to implement some function. > > > > For example, if you need to manage some varying sized amount of data, > > there are several different ways to handle it. If you're dealing > > with a compute-bound application (like a compiler), a reasonable > > approach would be to use a linked list, using pointers and malloc's. > > But application programs typically are I/O bound, not compute bound, > > and so program performance is less of a concern. In this case, a > > table in a database would be easier to understand and easier to > > maintain, along with other advantages, like persistence. > > > > In other words, just because you have some capability, it doesn't > > mean you have to use it. > > > > The essence of good software engineering is not just knowing how to > > use some tool, but also knowing how NOT to use it. > > > > >rpg400-l messages indicate that many RPG IV programmers are using them > > >to great advantage. > > > > ... and often having lots of problems with them. :-( > > > > Cheers! Hans > > > > Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com > > > _______________________________________________ > 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 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.