Sujet : Re: GIMP 3.0.0-RC1
De : commodorejohn (at) *nospam* gmail.com (John Ames)
Groupes : comp.os.linux.misc comp.os.linux.advocacyDate : 12. Feb 2025, 22:21:07
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250212132107.00001351@gmail.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
User-Agent : Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32)
On Wed, 12 Feb 2025 20:20:04 -0000 (UTC)
candycanearter07 <
candycanearter07@candycanearter07.nomail.afraid>
wrote:
If you really need to, you can also pass by pointer?
I admit I'm not deeply familiar with this, but AFAICT Pascal pointers
enforce type-safety as defined by the rest of the language, meaning
that (IIUC) you can pass a function that expects a pointer to an ARRAY
[1..10] OF CHAR any given ARRAY [1..10] OF CHAR, but trying to give it
a pointer to an ARRAY [1..15] OF CHAR would still be a type mismatch.
So what do you do, then? Refactor the function to accept a pointer to a
single CHAR? Add individual wrapper functions to decompose arrays of
specific sizes into individual elements, and call the actual function
once per element? What if the function logic can't be serialized across
individual elements?
The whole thing is just braindead. C makes you do all the fancy
footwork yourself if you want to support arrays of arbitrary size, but
it'll at least let you *do* it; other languages like Basic or Python
provide a UBound() function or for-each construct so that you can do
the same thing safely and simply (if at a slight performance penalty.)
Pascal (as Wirth designed it) forces you through all the rigamarole of
the former without giving you the attendant flexibility, even though it
already *knows* the sizes of arrays and could just as easily provide
the latter.
Truly demented, and worthy of a place in the B&D hall-o'-shame all by
itself.