|
Gary Guthrie wrote: >Ah, but it does have general usefulness. It's just that >the silly example I used doesn't cause the usefulness >to jump out at you. > >Consider that > >- -1 is a dead customer >- -2 is a customer who never pays >- -3 is an industrial spy > >Consider further that the procedure is likely housed >in a service program. Some applications might need >to know specific errors (hey, is this a dead customer >or a deadbeat customer!), others don't really care >about the specific error. Rather they just care that >there's some error. > >So, the usefulness of *NEGATIVE and *POSITIVE figurative >constants is in the ability to code a layer that is independent >of the details. This would be clearer ... -snip- With all due respect, which is clearer and more independent of the details? if GetCustomerStatus(CustomerID) = *Negative ... endif if CustomerError(CustomerID) ... endif callp GetCustomerStatusAndErrorState(CustomerID: Status: ErrorState) if ErrorState = WARNING ... endif Why overload GetCustomerStatus with the implied job of reporting an "error" as well as a specific status? If you break out the error reporting as a separate parameter or function, you get to have other facets of the customer that can cause an error, and not limit yourself to negative status codes. Once you've made the leap from "negative means error," the next logical step is "how severe is the error?" It gets ugly fast if you start tying the severity to a range of negative numbers. I suspect that the tradition carries on in C because... it's traditional! <grin> Buck Calabro +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.