Liste des Groupes | Revenir à co vms |
On 2024-08-20, chrisq <devzero@nospam.com> wrote:Few languages support multiple return values.I guess another complication is that some functions returnOne thing I wish was available in all languages is the ability to 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.
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.
Les messages affichés proviennent d'usenet.