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-Thread: 103376,e2be1c8e99a1c994 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!wn11feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Adding offset to 'Address Reply-To: no to spamers (No@email.given.org) References: X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Fri, 19 Sep 2008 09:25:06 GMT NNTP-Posting-Host: 12.64.24.56 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1221816306 12.64.24.56 (Fri, 19 Sep 2008 09:25:06 GMT) NNTP-Posting-Date: Fri, 19 Sep 2008 09:25:06 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:2041 Date: 2008-09-19T09:25:06+00:00 List-Id: Well have you looked at Ada-2005 language code, lately. It seams that in every upgradde that the maintainer ( Adacore ) are replacing Ada defined type with System.Address, more and more. But in relooking at this thread maybe the person wants the next version of Ada to have the following type of variable attribute for 'Address. Variable'Address ( Offset ) Now, for this thread: Count : Natural ; -- Count is set to the largest index that you may need function Address_Offset ( Source : in System.Address ; Index : Natural ) return Array_Element_Type ; type Storage_Array is array ( 0..Count ) of aliased Array_Element_Type ; Array_Source : Storage_Array ; for Array_Source'Address use Source ; begin if Index >= 0 and Index <= Count then return Array_Source ( Index ) ; else raise Storage_Error ; end if ; end ; This is based on the Memcy package. In , "Randy Brukardt" writes: >"Kim Rostgaard Christensen" wrote in message >news:gaqhs6$690$1@jacob-sparre.dk... >> tmoran@acm.org wrote: >>>> Raw_Bytes : access Unsigned_Char >>>> for Ethernet_Header'Address use Raw_Bytes.all'Address; >>>> >>>> and additionally need something like: >>>> for IP_Packet'Address use Raw_Bytes.all'Address + Ethernet_Header'Size; >>> >>> It's not clear to me exactly what problem you are trying to get past. >> >> The problem was basically to perform arithmethics on system addresses > >No, that's a (bad) solution to some problem, not a problem by itself. The >problem seems to be how to access the data bytes without accessing the >header, and Tom suggests a good solution for that. (We use versions of it in >Claw.) > >IMHO, the use of Address in Ada 95 or newer code (other than to specify raw, >absolute machine addresses) is never necessary and represents bad >programming. I see it fairly often here, and it makes me ill. I much prefer >general access types and possibly Unchecked_Conversions, because you lose >much less strong typing that way (and the code is better without the need >for heroic efforts on the part of the compiler). > > Randy. > > > Randy. > >