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: 12 Sep 2004 22:56:49 -0700 Organization: http://groups.google.com Message-ID: References: <49dc98cf.0408110556.18ae7df@posting.google.com> <413e2fbd$0$30586$626a14ce@news.free.fr> <1371289.WCcgO7lass@linux1.krischik.com> NNTP-Posting-Host: 24.219.97.214 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1095055009 28114 127.0.0.1 (13 Sep 2004 05:56:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 13 Sep 2004 05:56:49 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:3655 Date: 2004-09-12T22:56:49-07:00 List-Id: Martin Krischik wrote in message news:<1371289.WCcgO7lass@linux1.krischik.com>... > Kevin Cline wrote: > > > 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. > > K&C was not at all usefull. It was far from perfect, but a huge fraction of the applications in use today were written in C. There can be no question that C was useful. > Almost imediatly "lint" appeared to save you > from all the pitfalls C hat. So what? That's like complaining that grep is flawed because it doesn't paginate its output. K&R did not set out to design the ultimate programming language. They designed a language that was useful to their team. AFAIK, C was basically designed to replace PDP-11 assembly language. It did that pretty well, and facilitated the development of the first portable operating system. Then some other people came along and decided that they would like to program in C too, and got the compiler from AT&T. > > Of corse C has become more usefull But as a result it is not small anymore. > The ISO/IEC 9899:1999 is just as big as the RM but mor difficult to read. > And I am not aware of any compiler which supports the standard in full. > > > > Stroustrup didn't spend much > > effort on arrays, perhaps because he didn't think they were so > > important. > > Since I do own the ISO/IEC 9899:1999 I have one to swallow for your > (6.7.5.2, Page 117): > > extern int n; > extern int m; > void fcompat (void) > { > int a[n][6][m]; > > And next page it becomes even cooler: > > void fvla (int m; int C[m][m]); > > void fvla (int m; int C[m][m]); > { > typedef int VLA[m][m]; > ... > int D[m]; > > It looks like the C comunity have finaly found out that K&R and Stroustrup > have bee wrong and arrays with bounds are important after all. I don't program in C anymore, so I haven't paid much attention to the 1999 standard. Almost certainly K&R left out that feature because it means that the offset to local variables in the stack frame is no longer a compile-time constant. > > > 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. > > But I do: > > >wc --lines AdaArray.C AdaArray.H > 95 AdaArray.C > 467 AdaArray.H > 562 insgesamt Great. Now, if I ever want an Ada-style array for C++, I know what to look for. I don't care if a feature is built into the compiler or comes from library code. That was a conscious decision by the C++ community -- don't put something in the language if writing a class will do just as well. I expect that most of Ada's features could be implemented as C++ library code. But what do I do when I need the power of C++ templates in Ada?