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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable 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!news2.google.com!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) Date: 03 Oct 2004 08:47:38 -0400 Organization: Cuivre, Argent, Or Message-ID: References: <1700922.2nPlMsa4Ny@linux1.krischik.com> <1636756.M7hCqjsVMv@linux1.krischik.com> <415c36c0$0$91010$39cecf19@news.twtelecom.net> <4c2ec8a8.0410012335.dcf9001@posting.google.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1096807681 84771 212.85.156.195 (3 Oct 2004 12:48:01 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Sun, 3 Oct 2004 12:48:01 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:4594 Date: 2004-10-03T08:47:38-04:00 "Randy Brukardt" writes: > But I admit that I still can't figure out what it is that this "pointer to > member" does that is different than taking an access of a component. The > only thing that Ada doesn't have here is an equivalent to "void", which is > of course about safety - all access types have to have a designated type. >>From the example posted, it appears a "pointer to member" is an offset from the start of the record, rather than an absolute pointer. So, in psuedo-Ada : type A_Type is record A : Integer; B : Integer; end record; type A_Component_Access_Type is access component A_Type; Access_B : A_Component_Access_Type := A_Type.B'Component_Access; -- Note that 'Component_Access takes a _type_, not an _Object_. D : A_Type := (1, 2); E : A_Type := (3, 4); F : Integer := D.Access_B.all; G : Integer := E.Access_B.all; Now F = 2 and G = 4. Of course, this is the same as: F : Integer := D.B; G : Integer := E.B; But if the names are long and complex, the pointer to member might be a good optimization (like a renames). I'm not clear on exactly how that would work. I don't see how it relates to database fields. -- -- Stephe