|
Posted by Thomas Mlynarczyk on 11/18/05 23:43
Also sprach Erwin Moller:
> As Micha wote: Now you cannot distinguish between an 'error NULL' and
> 'real NULL'.
> And what about a function that could return NULL and false, both as
> usefull values?
In that case, I suppose, I would really have a problem. Still, it seems to
me that the case where a function could "legally" return NULL is much rarer
than that of a function returning a boolean. On the other hand, I just
realized, if a function would not normally return anything, then booleans
are "required" to indicate failure (FALSE) or success (TRUE). So that might
have been a reason, too, for choosing FALSE to indicate an error, I suppose.
But apart from such considerations - there is thus no technical drawback to
using NULL instead of FALSE to indicate an error?
> So if you find yourself in such a situation, be creative.
> eg: always return your value in an array (only one element big if
> needed), OR let it return false.
Indeed, a creative proposal. I will keep this in mind.
Thanks to both of you!
Greetings,
Thomas
Navigation:
[Reply to this message]
|