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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed.mathworks.com!irazu.switch.ch!switch.ch!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: "Must instantiate controlled types at library level." Why? Date: Thu, 13 May 2004 09:10:43 +0200 Organization: AdaCL Message-ID: <2780491.NPbR8AFya6@linux1.krischik.com> References: <13392802.3gDeTK7ybb@linux1.krischik.com> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1084434480 01 8104 f7d2GiblnC0P+41 040513 07:48:00 X-Complaints-To: usenet-abuse@t-online.de X-ID: TlCCSmZrweYfHiFIKv9c9QHaxKMdqGcDPFyi4GPx2jDCGn7Vv0FD4a User-Agent: KNode/0.7.7 Xref: controlnews3.google.com comp.lang.ada:525 Date: 2004-05-13T09:10:43+02:00 List-Id: Peter C. Chapin wrote: > Martin Krischik wrote in > news:13392802.3gDeTK7ybb@linux1.krischik.com: > Actually I tried this modification. In fact, the three C++ compilers I > used *do* produce a compile time error on this code. In particular the use > of an auto variable in the member function of a local class is > specifically illegal. The relevant language from the C++ standard is in > section section 9.8, paragraph 1: "Declarations in a local class can use > only type names, static variables, extern variables and functions, and > enumerators from the enclosing scope." The standard then goes on to give > an example showing that the use of an auto variable is illegal. Well, here you have a good example of the difference of Ada and C++. Ada has a complete ban on the construct while C++ goes out and about to ban only the tricky part. Off course the C++ ISO standart is 200 pages longer the Ada Standart. And that's without tasking, without protected types, without indefinite types and with a need for clone() functions. Just in case you did not know: P is tagged .... P_Class is access P; C is new P .... A_C : C := ... A_P : P'Class := P'Class (A_C); A_P_Ptr : P_CLass := new P'CLass'(A_C); A_P and A_P_Ptr will contain a copy of C. With Regards Martin PS: I hope you don't mind my other post to much. You do dig deeper and you do know the ISO standart so my rant about the average C++ programmer does not apply to you. -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com