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

Hollis Blanchard
2003-07-11T03:48:15Z

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