Re: [PHP4BETA] cvs: /php4/ext/standard array.c
| From: | Andrei Zmievski | Date: | Wed, 29 Mar 2000 17:18:58 +0000 |
| Subject: | Re: [PHP4BETA] cvs: /php4/ext/standard array.c | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-12809@lists.php.net to get a copy of this message | ||
On Wed, 29 Mar 2000, Sterling Hughes wrote:
> I agree that every function with return type 'void' should return NULL either on
> success or on failure from non-user errors, however, I think when the user does something wrong (in
> the case of array.c most of the return values changed are for invalid types), the program should
> whine and bitch in every possible way, including returning false.
>
> As far as array.c is concerned many of the functions that are prototyped as void (such as rsort
> or sort or any of the sort functions actually) return true on success, therefore shouldn't it
> make sense that they return false on failure?
>
> If we decide to change the return value back to NULL on failure, perhaps we should stop the
> functions from returning true as well.
I don't know.. If the function is void, then it should be 'void', i.e.
return NULL. If you return TRUE/FALSE then it's not 'void' anymore, it's
'bool' and the return value indicates success or failure. But that's
inconsistent because other functions may return real TRUE/FALSE values
that have nothing to do with success/failure.
-Andrei
* All of the above is my opinion, unless specified otherwise. *