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!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: Wed, 29 Sep 2004 06:03:12 GMT NNTP-Posting-Host: 138.217.18.112 X-Complaints-To: abuse@bigpond.net.au X-Trace: news-server.bigpond.net.au 1096437792 138.217.18.112 (Wed, 29 Sep 2004 16:03:12 EST) NNTP-Posting-Date: Wed, 29 Sep 2004 16:03:12 EST Organization: BigPond Internet Services Xref: g2news1.google.com comp.lang.ada:4360 Date: 2004-09-29T06:03:12+00:00 List-Id: Kevin Cline wrote: > 2. AFAIK, Ada does not support pointer-to-record member so it would > have been necessary to somehow wrap each record member with a > function. You can take the address of a field in a record. I'm not sure what it means if you have a representation clause for the record though. If you do Gnat says... gcc -c fred.adb fred.adb:19:10: warning: taking address of object not aligned on storage unit so at least one compiler tells you there is danger. Presumably once you have the address, the pointer knows nothing about the special alignment of the object. What happens in the C world in similar circumstances? Dale The following compile with gnat v3.3... with system; use system; procedure Fred is type R is record a : integer; b : character; end record; A : System.Address; rec : R; begin A := rec.a'address; end; with system; use system; procedure Fred is type R is record a : integer; b : boolean; end record; for R use record A at 0 range 0..31; b at 4 range 3..3; end record; A : System.Address; rec : R; begin A := rec.b'address; end; -- dstanbro@spam.o.matic.bigpond.net.au