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



Rob,

I have no problem with him using pointers, provided that it's clear in his head how things work. And I think it'd be great if he learns how to use pointers, and succeeds in getting the concepts straight in his head.

My caution was purely against writing pointer code that he doesn't understand (which is clearly the case at the moment) and then putting it into production somewhere. He needs to clearly understand it.

As for him using a pointer to access the output of an API -- why on earth would you use the CLEAR op-code for that?!


rob@xxxxxxxxx wrote:
Scott,

I respectfully disagree with any general statements like removing pointer logic from the program.

And since he's using a data structure I am wondering if he's using something like QUSPTRUS to process a list returned by some API. I find QUSPTRUS better than QUSRTVUS.

Going back to QUSRTVUS would make as much sense as IBM dropping the ADD op code and also dropping
number = x + y;
and making you do something like
number = AddNumbers(x : y : ErrDS);
Select;
When ErrDS.ErrCode=NoError;
// ok
ProcessAddedUpNumbers(number);
When ErrDS.ErrCode= TruncationError;
// Truncation occurred
Other;
// generic error handler
EndSl;

He simply needs to consider whether or not he needs to initialize the data structure at all, and if so, ensure that the basing pointer is set first.

When using a data structure in list logic (like the API example above) I wouldn't see a reason to ever initialize it. The values would change upon adding the increment to the pointer. And if you checked the error code upon the initial call to QUSPTRUS and didn't muff up the looping logic you should be fine.

Better to teach someone than to scare them off.

Rob Berendt


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.