From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1fa85f3df5841ae1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Sun, 01 May 2005 22:19:08 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <426e4c2b$0$7515$9b4e6d93@newsread2.arcor-online.net> <0uYbe.542$BE3.229@newsread2.news.pas.earthlink.net> <1wjh6qsazg3rg$.lupowyuqu0tw$.dlg@40tude.net> Subject: Re: Ada.Containers.Vectors - querying multiple elements Date: Sun, 1 May 2005 22:21:42 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4927.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 Message-ID: <1O2dnYJF_uSxAejfRVn-2Q@megapath.net> NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-uchp7I6qI0uo8z4BhGDcykt6Xl7bdZ+VGgMCBKRwJ/ymbhcbUTOso1ZIbrE4EAZCg3k7MChHNMTW6gw!i460CjjMs7JbjQKfRY1nDViaZQ+cYfD5slju1WwTMvQYWLvFZ4OKECep6Pv0254WrWczlLdT0thM X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.31 Xref: g2news1.google.com comp.lang.ada:10863 Date: 2005-05-01T22:21:42-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:txah28f4zlnp$.1pqea609lovyn.dlg@40tude.net... ... > Now consider the following test: > > type T is mod 1; > type T_Array is array (T range <>); > X : T_Array := ; > begin > for I in X'Range loop -- This is OK > null; > end loop; > for I in X'First..X'Last loop -- This cannot be OK > null; > end loop; > > Which is in a perfect contradiction with 3.6.2(7). It could probably be > mended too if we had universal index types. But this is yet another story. In Ada as currently defined, you would get Constraint_Error from the attempt to define the bounds. That happens with string types: type T is mod 1; type T_Array is array (T range <>) of Character; X : T_Array := ""; -- Raises Constraint_Error There is actually an ACATS test to check this. (I remember it because one vendor disputed the test; it was upheld.) You'd get the same result if there was a way to describe a null array aggregate: X : T_Array := (null array); -- Not Ada, and if it was, it would raise Constraint_Error here. It turns out that Interfaces.C.To_C has a similar problem, and it too raises Constraint_Error for a null string (if not null terminated). Of course, you could conceivably use other rules, but they'd be incompatible with the current ones, which wouldn't be a problem in cases like these, but they might be in other cases. Randy.