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