From: "Samuel T. Harris" <samuel_t_harris@Raytheon.com>
Subject: Re: Enhancement needed
Date: 2000/09/17
Date: 2000-09-17T00:00:00+00:00 [thread overview]
Message-ID: <39C5530F.B7849F7A@Raytheon.com> (raw)
In-Reply-To: feMY0DAzxTw5EwOG@ntlworld.com
Michael Pickett wrote:
>
> In article <8pol3q$dnqb3$1@ID-25716.news.cis.dfn.de>, Nick Roberts
> <nickroberts@callnetuk.com> writes
> >I'd be grateful if you would mention what it was that you actually wanted
> >your compiler to do, so I can make mine do the same. I'm always eager to
> >please. People seem to think that compiler writers have to be legally
> >coerced into doing anything; some of us will actually respond to a little
> >courtesy. ;-)
>
> I wasn't the original poster, and I didn't retain the earlier postings,
> but as far as I recall, the expectation and previous experience was that
> setting the Size attribute for a record type should result in the
> compiler adjusting, if necessary, the internal layout of the record from
> the default layout.
I find that expectation dubious, from whereever it comes.
Consider the following problem.
A memory mapped device provides a collection of data at a specific
memory address. I use an Ada record to overlay that address.
I need a rather explicit representation clause to exactly
place each field in the appropriate location. I need an address
clause to place the record object at the appropriate place
in memory. I use a size clause as an extra check to ensure
my record layout indeed fits the size of the memory area.
I definately don't want the size clause changing the layout
at all. I expect a warning is the size is too large for the
record and an error if it is too small.
Consider another problem.
I'm interfacing to a C API. I used to use rep clauses on the
records to make them fit, but I now have pragma Convention
in Ada 95 which eliminates all that drudgery. I still use
a size clause to confirm the record will fit into the size
I want. Pragma Convention defines the layout, I don't want
the size clause changing it.
If all I'm after is a packed version of the record with no
padding or extra bits, then I expect pragma pack to do the
job.
--
Samuel T. Harris, Principal Engineer
Raytheon, Aerospace Engineering Services
"If you can make it, We can fake it!"
next prev parent reply other threads:[~2000-09-17 0:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-09-12 12:51 Enhancement needed (was strange record size ?) Michael Pickett
2000-09-12 23:03 ` John McCabe
2000-09-13 0:00 ` Michael Pickett
2000-09-13 0:00 ` Enhancement needed Nick Roberts
2000-09-13 0:00 ` Robert A Duff
[not found] ` <feMY0DAzxTw5EwOG@ntlworld.com>
2000-09-17 0:00 ` Samuel T. Harris [this message]
2000-09-17 0:00 ` Ted Dennison
2000-09-18 0:00 ` Samuel T. Harris
2000-09-25 4:26 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox