lkml.org 
[lkml]   [2003]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: Style question: Should one check for NULL pointers?
From
On Thursday, Jul 10, 2003, at 17:54 US/Central, David D. Hagood wrote:
>
> Now, if you have some function that can return an error code, then
> testing for NULL and returning an error condition is sensible. But if
> you have no way to report the error, then what good is the test?

Then you add the test, fix your interface to be able to report the
error, and update callers as necessary... if your code can fail, you
should be able to report it.

When writing a new function you think returns void, seriously consider
having it return success instead.

--
Hollis Blanchard
IBM Linux Technology Center

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.144 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site