Jeffrey Walton wrote:
> You should consider making the interface easy to use correctly, and
> hard to use incorrectly. That will help novice programmers avoid
> mistakes.

Novice programmers need to learn that they need to look at the return
value. Once they have learned this, everything is easy.

> In that light, set the ptr to NULL to make it as safe as possible.

With the same argument, you could claim that functions that can set
errno should always set errno to 0 when they succeed. So that
users don't need to set 'errno = 0;' before the call, if they want
to inspect errno after the call, regardless of the return value.

Bruno




Reply via email to