Using `lower' and `upper' whenever possible on arrays is good advice. It is
only manifest arrays that can be counted on to begin with one if it is used
as originally presented. I have never attempted to do so but I think that
even manifest arrays could be resized or have `upper' or `lower' altered.
Regards
Chris Saunders
----- Original Message -----
From: carl94706
To:
[hidden email]
Sent: Sunday, October 18, 2009 4:17 PM
Subject: [eiffel_software] Re: {BOUNDED_QUEUE}.linear_representation
Yes,
I do agree it looks like a bug. It produced incorrect results when I tried
the code on my machine.
When you don't use the upper and lower features, you get burned...
Carl
--- In
[hidden email], "Paolo" <technoben59@...> wrote:
>
> Ok, say that arrays start at 'min' (can be what you want, I think we
> cannot say that Eiffel's arrays have a default start at zero or one. I
> said zero because at debugging they're displayed starting at zero).
>
> What I would say is that function {BOUNDED_QUEUE}.linear_representation
> seems wrong. It runs on 'fl' (an array starting at ... zero) and,
>
> if out_index > in_index then
>
> check first the final section of array and then the starting section, but
> starting at 1 (not at 0, like other (right) functions as 'has' do), so it
> skips the first element. Don't you agree?
>
>
> --- In
[hidden email], <rfo@> wrote:
> >
> > The default lower bound for ARRAYs (and their friends) is 1 in Eiffel
> > (not EiffelStudio per se).
> >
> > ==================================================
> > Roger F. Osmond
> >
> >
> > > -------- Original Message --------
> > > Subject: [eiffel_software] Re: {BOUNDED_QUEUE}..linear_representation
> > > From: "David" <dlebansais@>
> > > Date: Fri, October 16, 2009 6:57 pm
> > > To:
[hidden email]
> > > >
> > > > fl is an array, so it shoud start at 0, not at 1 (>>>). Am I wrong?
> > > >
> > > > If it's not wrong, I don't understand very well the usage of this
> > > > function. Bye.
> > > >
> > > Arrays start at 1 in EiffelStudio. At least, manifest arrays do as
> > > well as lists, and strings if my memory is correct.
> > > I hate it every day but that's another story.
> > > Regards,
> > > David Le Bansais.
> >
>
> --- In
[hidden email], "Paolo" <technoben59@> wrote:
> >
> >
> > Hi. Perhaphs I say a big asinine, but it seems that the source code of
> > {BOUNDED_QUEUE}.linear_representation is wrong. It says:
> >
> > linear_representation: ARRAYED_LIST [G]
> > -- Representation as a linear structure
> > -- (in the original insertion order)
> > local
> > i: INTEGER_32
> > do
> > create Result.make (count)
> > if out_index > in_index then
> > from i := out_index
> > until i >= fl.count
> > loop
> > Result.extend (fl.item (i))
> > i := i + 1
> > end
> > from
> > >>> i := 1
> > until
> > i >= in_index
> > loop
> > Result.extend (fl.item (i))
> > i := i + 1
> > end
> > else
> > from i := out_index
> > until i >= in_index
> > loop
> > Result.extend (fl.item (i))
> > i := i + 1
> > end
> > end
> > end
> >
> > fl is an array, so it shoud start at 0, not at 1 (>>>). Am I wrong?
> >
> > If it's not wrong, I don't understand very well the usage of this
> > function. Bye.
> >
>