Re: Style question: Should one check for NULL pointers?

Hollis Blanchard (hollisb@us.ibm.com)
Thu, 10 Jul 2003 23:02:33 -0500


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/