TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Stephen Leake <[log in to unmask]>
Reply To:
Stephen Leake <[log in to unmask]>
Date:
Tue, 8 Jul 2003 09:58:25 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (24 lines)
Jean-Pierre Rosen <[log in to unmask]> writes:

> >11..10 and 1..0 are both null slices (i.e. statically known to be empty).
> Your code therefore assigns a null slice >to a null slice and no
> out-of-bounds array accesses occur so no error occurs.
> >
> >I would hope that a(10..11) := b(0..1); would raise a rich crop of
> constraint errors.
>
> No. A null slice never raises Constraint_Error (4.1.2(7)).

You missed that he changed things for this statement; "a (10 .. 11)" is
_not_ a null slice.

The original example was "a (11 .. 10)", which _is_ a null slice.

The point is that for null slices, the indices are not checked. So
even though "11" is outside the bounds of indices of "a", "a (11 ..
10)" does not raise Constraint_Error. But for "a (10 .. 11)",
Constraint_Error is raised, since it is not a null slice.

--
-- Stephe

ATOM RSS1 RSS2