|
>> However, by the same token, I don't think returning a pointer to a user >> space is a good idea, either!! The calling program shouldn't need to know >> that you've stored your data in a user space, or dynamic memory, or a >>file, or anything else -- all of that should be transparent to the caller! Thanks for the comments. When I say returning a pointer to a user space, I am talking about returning from a User Space API. I have one called XVUSPC that is in my trigger mediator package. In this case, it is the user of the API that is getting a pointer back. All it is doing is encapsulating the API calls. In my generic string parser, I store my state transition tables in a user space so from inside the generic string parser, I make a call to the XVUSPC API to get a pointer into the user space. This is done inside the service program. The user is just calling the load function, the load string function and the parse. How it is implemented, they do not know. Anyway. >> I consider this approach to be acceptable. Now, I know someone is going >> to reply to this message and tell me that I should use a numeric handle >> instead of a pointer. And, I don't disagree, but I don't think the >> pointer method is bad, either. I would be one of those people who think that you should return a numeric handle. Lately I have taken that one level further in IFS and that is to have the user assign a name to the open. Some string constant and then refer to the open through that name. I have found that the numeric number getting confusing to users of the function but I would definitely feel there is no reason to return a pointer in this case. Just to easy for the user to screw it up and all that can be hidden. In your example, could you not pass the order identifier to the new function and refer to the order from that. In this example, also, it would seem that the result would be an order number. Wouldn't that be preferable to returning the pointer? Seems like the pointer is not really needed. Anyway, my thoughts anyway.
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.