| Deutsch English Français Italiano |
|
<va24l8$3ce14$3@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: chrisq <devzero@nospam.com> Newsgroups: comp.os.vms Subject: Re: New VSI post on Youtube Date: Tue, 20 Aug 2024 14:11:04 +0100 Organization: A noiseless patient Spider Lines: 44 Message-ID: <va24l8$3ce14$3@dont-email.me> References: <v9ehs5$3mqbj$1@dont-email.me> <v9idff$f9k4$1@dont-email.me> <v9iqln$hrs3$1@dont-email.me> <v9iro6$fql6$1@dont-email.me> <66bcf876$0$717$14726298@news.sunsite.dk> <66bcfbe3$0$717$14726298@news.sunsite.dk> <v9kske$uqhh$2@dont-email.me> <va04hl$2viks$2@dont-email.me> <66c397f6$0$716$14726298@news.sunsite.dk> <va226u$3ce14$1@dont-email.me> <va22l3$3cdrf$4@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 20 Aug 2024 15:11:05 +0200 (CEST) Injection-Info: dont-email.me; posting-host="beeeccf002db1315b7ea26e0a9d9ffba"; logging-data="3553316"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Efj6xM0zYZvk756lkuWav" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:Soh5QWacGYI4gElT72X2bH3zOR0= Content-Language: en-US In-Reply-To: <va22l3$3cdrf$4@dont-email.me> Bytes: 3092 On 8/20/24 13:36, 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);". The way to get round that here, for many functions with multiple parameters, is to declare a structure, with the args, status and even status qualifier. Can include buffer pointers and lengths as well. Fill in the args, then pass a pointer to that for the call. Not only is it efficient, as it can be passed using single register, but it's also easy to add structure elements without affecting other code that calls it. It can help to make code fully rentrant and is a way to get some abstraction for little effort. Also seems like good practice, as one of the key design tasks should be to accurately define and encapsulate the interfaces to the code. Quite a bit of unix code that uses such techniques, as does vms with descriptors, if that'a the right name for it. Chris > 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. > > Simon. >