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!news3.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: Fri, 29 Apr 2005 15:16:16 -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> Subject: Re: Ada.Containers.Vectors - querying multiple elements Date: Fri, 29 Apr 2005 15:18:51 -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: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-nvZqvBRsDUFpOTLptXsRDMOsZCwii0GGd1gaRuDA+O7G5Uckr834rvuBRkfLmJLWMhFtn/ZVaLzVvMb!gnFwCYZhBWzjDeQj33JC4XD7IjfgacWhwb+FQGYhiNloyKv+OWrBLhiBwat3Q2NQ7YgYIjqvrbva 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.32 Xref: g2news1.google.com comp.lang.ada:10830 Date: 2005-04-29T15:18:51-05:00 List-Id: "Robert A Duff" wrote in message news:wccfyx94el8.fsf@shell01.TheWorld.com... ... > I don't think it's a problem, either. If you want zero-length arrays, > then you're counting things, and signed integers are the appropriate > index type. Arrays indexed by enums are usually things like tables, > and therefore not empty. Can you think of an example where you want > an empty array, and a enum or modular type is appropriate for the index? > I can't think of any at the moment. I can't think of any for enum, but for modular, it makes perfect sense. Remember, a modular type is the only way to get an unsigned type in Ada, and thus it's not unusual to declare such a value and give it a range, use it in arrays, etc. Yes, it would be worlds better if there was a real, checked, unsigned integer type in Ada (and I'd use that instead), but that was screwed up by the Ada 9X team, and it isn't going to get fixed. Most of my modern programs have a useful unsigned type somewhere near the start: type Counter_Type is mod 2**32; with various subtypes of that around. It's also not unusual to use a 16-bit modular type when space is tight. Now, I suppose if you're willing to assume that every Ada compiler supports 64-bit integers, supports unsigned storage representations, and doesn't do 64-bit operations when unsigned 32-bit operations will do, then you could avoid using modular types in this way. But the above doesn't describe any Ada compilers that I have used. Once those types are in wide use, it isn't usual for them to be used to index some data structure. And thus you get null array slices of modular types and the like. Randy.