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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews2.google.com!not-for-mail From: kevin.cline@gmail.com (Kevin Cline) Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request Date: 10 Sep 2004 16:56:20 -0700 Organization: http://groups.google.com Message-ID: References: <49dc98cf.0408110556.18ae7df@posting.google.com> <413e2fbd$0$30586$626a14ce@news.free.fr> NNTP-Posting-Host: 198.23.26.253 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1094860590 32177 127.0.0.1 (10 Sep 2004 23:56:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 10 Sep 2004 23:56:30 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:3573 Date: 2004-09-10T16:56:20-07:00 List-Id: Georg Bauhaus wrote in message news:... > Kevin Cline wrote: > : If you want bounded types in C++ it's easy enough to write a template > : class: > > True, but it is not quite the same thing, is it? You can write bounded > types in C. Yet, they don't become C language types, with ISO definded > semantics beyond what you'd expect for any user defined type. The Ada designers evidently thought arrays were really really important, because they provided elaborate language facilities to support array-based programming. The C language designers instead created a small but useful language. Stroustrup didn't spend much effort on arrays, perhaps because he didn't think they were so important. Instead he tried to make it easy to define and use new types as easily as one could use the fundamental types. > Does the C++ standard directly address the behavior of handwritten > bounded numbers? How many lines of template code will it take > to get the effect of > > type A is array(Some_Index_Type) of Foo;? I don't know. It could be done in C++ if Some_Index_Type had the right properties. But as a practical matter, no one seems to care, at least no one in the C++ community. I very rarely have any need or use for a statically sized array. Even if I did want a static array with non-integer indexing, unless it's really important to shave 100 nanoseconds from the lookup time, a map will do just as well, and that's the canonical solution in both C++ and Perl. > #include > > struct _bint { > long v; > int up, lo; > }; This is quite ugly, not to mention inefficient. But I would never advocate use of C for writing an application of any size.