comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Adding offset to 'Address
Date: Fri, 19 Sep 2008 01:09:53 -0500
Date: 2008-09-19T01:09:53-05:00	[thread overview]
Message-ID: <gavfnq$kgp$1@jacob-sparre.dk> (raw)
In-Reply-To: gaqhs6$690$1@jacob-sparre.dk

"Kim Rostgaard Christensen" <krc@greenpc.dk> 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.





  reply	other threads:[~2008-09-19  6:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-12  8:35 Adding offset to 'Address Kim Rostgaard Christensen
2008-09-12  9:47 ` Georg Bauhaus
2008-09-12 10:17   ` Kim Rostgaard Christensen
2008-09-12 11:18     ` petter_fryklund
2008-09-12 15:23 ` Adam Beneschan
2008-09-12 21:40   ` Robert A Duff
2008-09-13  0:37     ` Adam Beneschan
2008-09-13  6:21   ` tmoran
2008-09-17  9:15     ` Kim Rostgaard Christensen
2008-09-19  6:09       ` Randy Brukardt [this message]
2008-09-19  9:25         ` anon
2008-09-13 10:18 ` Björn
2008-09-17  9:18   ` Kim Rostgaard Christensen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox