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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7f2ce8bda9cae4ab X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn51feed!worldnet.att.net!208.48.142.85!newsfeed.news2me.com!Spring.edu.tw!news.nctu.edu.tw!feeder.seed.net.tw!attdv1!ip.att.net!newsfeed1.global.lmco.com!svlnews.lmms.lmco.com!not-for-mail From: "Xenos" Newsgroups: comp.lang.ada Subject: Re: "Must instantiate controlled types at library level." Why? Date: Fri, 14 May 2004 09:50:03 -0400 Organization: Hades Message-ID: References: <13392802.3gDeTK7ybb@linux1.krischik.com> <2780491.NPbR8AFya6@linux1.krischik.com> <11924003.IfRfnULeIG@linux1.krischik.com> <1676457.GMYvKY1ieA@linux1.krischik.com> NNTP-Posting-Host: 158.187.64.144 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Xref: controlnews3.google.com comp.lang.ada:582 Date: 2004-05-14T09:50:03-04:00 List-Id: "Martin Krischik" wrote in message news:1676457.GMYvKY1ieA@linux1.krischik.com... > Freejack wrote: > Simple Mantra: 'Class behaves like String. > > If you compare with C/C++: You always have to uses char* pointers since > C/C++ has no equivalent for String. Wrong. C++ has a string class in its standard library. Its a lot more versitile than Ada's String type. > > In C an array is either definite "int X[10]" or you use pointer. "int X[]" > is only another syntax for "char*" since there is no 'First and 'Last in > C/C++. Ada however has indefinite types - so pointers arn't neede here. > Wrong. In certain situations, an array will "degrade" to a pointer to its element type. As a function parameter int X[] will degrade to a constant pointer to an integer, or int * const. It is NEVER eqvilent to char*. You must be thinking of Classic C (before the standard) were a char* was used at the generic pointer type before void* was introduced. A generic pointer will accept any type of (non-function) pointer, but is still not equivilent to it. It is only during degradation that an array end is unknown to the compiler. C++ has the vector (et. al.) where .begin() and .end() are equivalent to 'First and 'Last. > Also you use pointers because C/C++ has no "out" or "in out". Ada however > decides itself if call by value or call by reference is needed. So no > pointers needed here as well. Wrong. C++ has reference types are equivalent to "in out." Constant reference types may be used for "in." If you don't understand a language, you don't have any grounds to lambaste it.