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



On 10/14/2010 11:41 AM, Christen, Duane wrote:

I understood the discussion in this thread, http://archive.midrange.com/rpg400-l/200611/msg00396.html incorrectly. I took it as recommendation not to clear/test errNo. I think, now, though it was a best practices example. Either way though, if implemented consistently either method will work.


I agree that there is no point in setting errno in advance for functions that return an indication of failure in some other way. In those cases, it makes sense to just check errno if more information is needed about the error.

But for those functions where errno is the only way to detect failure, errno should be set to zero before calling the function.

So there are two patterns depending on the nature of the function. Use the second pattern if the API documentation doesn't provide a return value or output parameter that indicates failure.

rc = function();
if rc <> 0;
check errno
...

errno = 0;
something = function();
if errno <> 0;
...

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.