comp.lang.ada
 help / color / mirror / Atom feed
From: "John R. Strohm" <strohm@airmail.net>
Subject: Re: 64bit access to an array of 8bit values
Date: Tue, 5 Mar 2002 12:49:25 -0800
Date: 2002-03-05T12:49:25-08:00	[thread overview]
Message-ID: <01D3EF1F744692CE.E4285A1E194C94B7.800ACE8F1D3EC3C7@lp.airnews.net> (raw)
In-Reply-To: s2tg8.43726$%b6.11496771@typhoon.ne.ipsvc.net


"Jeffrey Creem" <jeff@thecreems.com> wrote in message
news:s2tg8.43726$%b6.11496771@typhoon.ne.ipsvc.net...
>
> "John R. Strohm" <strohm@airmail.net> wrote in message
> news:0CFB5EECF8614F8D.52C8F36A468D2F14.3AD3D533D2B72FDB@lp.airnews.net...
> > The short answer is that you can't do what you want to do.
>
>
> The longer answer is that it is this abstract philosophical academic
mindset
> that convinces
> people that nothing can be done in Ada.  In fact you can do what you want
to
> do.
>
> There are several "as portable as C or better" approches that could be
taken
> to solve this problem
> (involving rep spec and either unchecked conversion of access types or
array
> slices) that
> will solve this problem just fine. Some of these would probably break on
> some compiler with
> lack of full annex support or strange word sizes..But most of the time it
> would be fine.

The key phrase in there is "most of the time".  I've spent too many years
fixing something that should have worked "most of the time" because I
happened to stumble into the part of the time where it DIDN'T.

The one that I remember was a rep spec for an 8-bit device control register,
on a 32-bit machine.  The LRM requires the compiler to preserve the other 32
bits, which means that every write of the device control register was also
generating a read, to get the 24 bits that I apparently wasn't planning on
changing so they could be pasted back in.  Unfortunately, it was rather
crucial that the register NOT be read at that particular moment.

What this taught me is that solutions that work "most of the time" DON'T
work ALL of the time, and the right answer is never be satisfied with
something that doesn't work ALL of the time.  Correctness is a binary
property.






  reply	other threads:[~2002-03-05 20:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-03 14:58 64bit access to an array of 8bit values Dave Poirier
2002-03-03 15:38 ` Jim Rogers
2002-03-03 18:02 ` John R. Strohm
2002-03-03 16:39   ` Dave Poirier
2002-03-03 17:27   ` Jeffrey Creem
2002-03-05 20:49     ` John R. Strohm [this message]
2002-03-05 23:52       ` Jeffrey Creem
2002-03-06  7:30         ` John R. Strohm
2002-03-06 11:50           ` Jeffrey Creem
2002-03-07 20:03             ` John R. Strohm
2002-03-04 10:29   ` Robert Dewar
2002-03-04 13:02     ` Larry Kilgallen
2002-03-04 13:41       ` Dave Poirier
2002-03-03 22:24 ` David C. Hoos, Sr.
2002-03-03 22:51   ` Dave Poirier
2002-03-04  2:40     ` David C. Hoos, Sr.
2002-03-04  4:08     ` David Starner
2002-03-04 10:31   ` Robert Dewar
2002-03-04 18:00   ` Warren W. Gay VE3WWG
2002-03-04  3:15 ` Pat Rogers
2002-03-04  7:23 ` Jeffrey Carter
replies disabled

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