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!border1.nntp.dca.giganews.com!nntp.giganews.com!news.moat.net!lon-transit.news.telstra.net!lon-in.news.telstra.net!news.telstra.net!news-server.bigpond.net.au!53ab2750!not-for-mail From: Dale Stanbrough Newsgroups: comp.lang.ada Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) 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> User-Agent: MT-NewsWatcher/3.4 (PPC Mac OS X) Message-ID: Date: Thu, 30 Sep 2004 07:54:15 GMT NNTP-Posting-Host: 138.217.18.112 X-Complaints-To: abuse@bigpond.net.au X-Trace: news-server.bigpond.net.au 1096530855 138.217.18.112 (Thu, 30 Sep 2004 17:54:15 EST) NNTP-Posting-Date: Thu, 30 Sep 2004 17:54:15 EST Organization: BigPond Internet Services Xref: g2news1.google.com comp.lang.ada:4430 Date: 2004-09-30T07:54:15+00:00 List-Id: kevin.cline@gmail.com (Kevin Cline) wrote: > 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. Indeed. > ASSERT(x1->*ptm == 3); > ASSERT(x2->*ptm == 4); > > ptm = &X::b; > > ASSERT(x1->*ptm == 5); > ASSERT(x2->*ptm == 6); > > 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. Ada can't do this directly. You can get the starting bit position of a field, and could convert this into a byte/word offset and add it to a pointer. Using the attribute 'First_Bit you can find the number of bits offset into a record, but only for an object, not a type. This means that you couldn't easily create a generic to do this without creating an object first. Does anyone know why this was restricted to objects only? Dale -- dstanbro@spam.o.matic.bigpond.net.au