Article View: comp.sys.amiga.tech
Article #2964Re: Problem with Draco's arrays
From: Chris Gray
Date: Wed, 14 Mar 1990 23:55
Date: Wed, 14 Mar 1990 23:55
43 lines
1730 bytes
1730 bytes
In <1693@geocub.greco-prog.fr> olch@geocub.greco-prog.fr (Olivier Charrier)
posting for gnu@cerisi.cerisi.fr (Cedric BEUST) writes:
> I found a little problem when trying to use arrays of unknown sizes as
>arguments in Draco's functions. I typed the example given in the doc,
>which looks like that:
>
>proc minimum([*] int t) int:
>int min,i;
>
> min := t[0];
> for i from 1 to dim(t,1) do
> if t[i] < min then min := t[i] fi
> od;
> min
>corp;
>
> The compiler returns the error 'cannot use sizeof on array with '*'' (or
>something like that), and indicates
>
> if t[i] < min then min := t[i] fi
> ^
> If I replace i with a constant or a numeric, it works. Why does this
>happen?
I tried the source from this article, and got a complaint about syntax
(it should be 'upto' in the 'for', not 'to'), but after fixing that, it
compiled fine. Can you mail me the exact routine that is failing? I used
my V1.3 beta version of the compiler, but my log files going back to Jan 88
show no changes that could have fixed a bug like that. Also, since Draco
arrays are 0 origin (same as C's), the 'for' loop should be:
for i from 0 upto dim(t, 1) - 1 do
...
od;
If all else fails, I can uuencode and mail you V1.3. (I haven't released it
yet since I want to do a whole new set of documentation.)
--
--
Chris Gray usenet: {uunet,alberta}!myrias!ami-cg!cg CIS: 74007,1165
Technical Details
Message-ID:
<02156.AA02156@ami-cg.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!van-bc!ubc-cs!alberta!myrias!ami-cg!cgShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!van-bc!ubc-cs!alberta!myrias!ami-cg!cg From: cg@ami-cg.UUCP (Chris Gray) Newsgroups: comp.sys.amiga.tech Subject: Re: Problem with Draco's arrays Message-ID: <02156.AA02156@ami-cg.UUCP> Date: 14 Mar 90 23:55:49 GMT Followup-To: comp.sys.amiga.tech Lines: 43