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,243dc2fb696a49cd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada References: <1777528.JKnUEYTOM6@linux1.krischik.com> <1ec946d1.0409230820.455ad242@posting.google.com> <3673998.bj16mkkOu2@linux1.krischik.com> <1700922.2nPlMsa4Ny@linux1.krischik.com> <1636756.M7hCqjsVMv@linux1.krischik.com> Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) Date: Thu, 30 Sep 2004 12:50:18 -0400 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: <415c36c0$0$91010$39cecf19@news.twtelecom.net> Organization: Time-Warner Telecom NNTP-Posting-Date: 30 Sep 2004 16:39:28 GMT NNTP-Posting-Host: a8a0f2d4.news.twtelecom.net X-Trace: DXC=e4<[elbEM`7i_U\QU:i6Z3C_A=>8kQj6=hHXa^^g6TZ44\7d95FA4R6dYZAA8S: "Kevin Cline" wrote in message news:e749549b.0409291942.5790386d@posting.google.com... > > There seems to be some confusion between creating a pointer to a > particular member of a particular record, and the C++ pointer to > member type. > > In C++: [snip] There seems to be some confusion between creating an offset to a record component, and simply using an Ada function pointer: In Ada: declare type T is record A, B : Integer; end record; function A (O : T) return Integer is begin return O.A; end; function B (O : T) return Integer is begin return O.B; end; type Query_Type is access function (O : T) return Integer; Query : Query_Type := A'Access; O1 : T := (3, 5); O2 : T := (4, 6); begin pragma Assert (Query (O1) = 3); pragma Assert (Query (O2) = 4); Query := B'Access; pragma Assert (Query (O1) = 5); pragma Assert (Query (O2) = 6); end; > The availability of pointers to members makes it possible to concisely > express the mapping between the a data member and the "A" column of a > database table. The availability of pointers to local functions makes it possible to concisely express the mapping between the A record component and the "A" column of a database table.