Liste des Groupes | Revenir à co vms |
On 2024-08-20, bill <bill.gunshannon@gmail.com> wrote:Uh ... sometimes ...On 8/20/2024 8:36 AM, Simon Clubley wrote:>On 2024-08-20, chrisq <devzero@nospam.com> wrote:>>>
I guess another complication is that some functions return
-1, which implies a signed variable. To fix all that would require a
complete rewrite of the library and probably most of the os and
applications as well, so it will never happen. Just have to write
unsigned equivalents, or slip functions with casts, but it's a lot
of additional work.
>
One thing I wish was available in all languages is the ability to return
multiple values from a function call so you can return both a status and
the value(s) in one assignment. Ie: "a, b, c = demo_function(param1, param2);".
>
In languages with dynamic associative arrays (such as PHP), I simulate
this by returning an associative array from a function call with both
status and value fields. Makes coding _so_ much cleaner and robust.
>
And probably much harder to understand in anything but the most
trivial usage.
>
Huh ? Well that shows you haven't done this kind of thing. :-)
>
If you are talking about PHP, you construct an associative array
in the return statement of the function and then access the keys
in the caller. Very clean.
>
If you are talking about some future thing based on C, you simply
extend the function prototype to include a list of return types
instead of the single type it is at the moment and you just return
the list in the function's return statement.
>
$ set response/mode=good_natured
>
Or are associative arrays and other higher-level data structures an alien
concept to you ? :-)
Les messages affichés proviennent d'usenet.