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