B
Ben Bacarisse
Barry Schwarz said:Are you deliberately trying to be obtuse. The NULL value returned
does exactly what was suggested, notify the user that the request
failed.
I suspect there has been a misunderstanding. As you helpfully quote,
Ike Naar said:
| The function, as written by the OP, does nothing useful (well, it
| leaks some memory), but others have already explained how that can be
| fixed. If those fixes are applied, the caller can detect that a
| malloc failure occurred by looking at the function's output, which, in
| that case, is NULL.
There have been two suggested fixes. One would have a NULL return
on error, the other would set a char * argument (passed to a char **
parameter) to NULL on error. Both can be seen as the "the function's
output".
I *think* osmium is objecting to the clumsiness of testing for this side
effect and his/her "No they don't!" was because malloc and friends *do*
return a char * rather than setting one.
Just a guess, but I could not ascribe any other meaning to the original
objection: "So it is your belief that error reporting is sufficient if
the user can deduce that the proper side effects occurred?".
<snip>