comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Addressing in Object Ada v/s GNAT (2013) showing Vast Differences
Date: Tue, 8 Sep 2015 00:02:34 +0300
Date: 2015-09-08T00:02:34+03:00	[thread overview]
Message-ID: <d56cbaF1hj7U1@mid.individual.net> (raw)
In-Reply-To: <ebc8750c-8cab-452d-a218-213c44c4ee31@googlegroups.com>

On 15-09-07 14:54 , Lucas Redding wrote:
> On Monday, September 7, 2015 at 12:39:35 PM UTC+1, Lucas Redding
> wrote:
>> Hi
    ...
>> I have a program that runs perfectly in Object Ada. The program
>> relies heavily on "USE AT" clauses together with 'SIZE on
>> underlying type definition. This is in order to map directly and
>> deterministically to memory with bit precision. The data is
>> independently produced so this is very important.
>>
>> I have compiled the program is GNAT Ada but I am getting run time
>> errors such as "misaligned address value". More worryingly, any
>> data read from memory that relies on the addressing mechanisms
>> described above is incoherent.
    ...
> I forgot to say that platform is Windows 7 (64 bit if that matters)
> and the data is in S_RECORD format (With correct ENDIANISM).

That sounds a bit confusing; S-record format is an ASCII (hex) text 
file. You probably mean that you read the S-record data and convert from 
ASCII hex to an octet array, octet per octet, and then you access that 
octet array using the "use at" mechanism.

I'm not surprised that you get errors -- this sounds very unportable to 
me (because of the "use at"). I understand that you have an existing 
program that you want to port, preferably without a lot of changes, but 
is it really worthwhile to port it from its old unportable form into a 
new and different unportable form?

For this problem, I would use the Ada Stream feature, either to read the 
S-record text directly into my data structure (i.e. the variables for 
which you use "use at", but which I would fill with Stream Read), or by 
converting the ASCII S-records into an octet array, and then viewing 
that octet array as an indexable in-memory Stream and using Stream Read 
to access the data objects within the octet array.

Just a suggestion, of course.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .

  parent reply	other threads:[~2015-09-07 21:02 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-07 11:39 Addressing in Object Ada v/s GNAT (2013) showing Vast Differences Lucas Redding
2015-09-07 11:54 ` Lucas Redding
2015-09-07 14:04   ` G.B.
2015-09-07 16:02     ` Lucas Redding
2015-09-07 16:28       ` Anh Vo
2015-09-08  7:30         ` Lucas Redding
2015-09-08 15:11           ` Anh Vo
2015-09-08 17:20           ` Jeffrey R. Carter
2015-09-07 17:20   ` Pascal Obry
2015-09-07 17:21   ` Pascal Obry
2015-09-08  7:04     ` Lucas Redding
2015-09-07 21:02   ` Niklas Holsti [this message]
2015-09-08  8:00     ` Lucas Redding
2015-09-07 15:48 ` Jeffrey R. Carter
2015-09-08  7:27   ` Lucas Redding
2015-09-08  7:12 ` Markus Schöpflin
2015-09-08  8:05   ` Lucas Redding
2015-09-10 10:47 ` Lucas Redding
2015-09-10 12:34   ` G.B.
2015-09-21 11:12     ` Lucas Redding
2015-09-21 11:57       ` Jacob Sparre Andersen
2015-09-21 13:22         ` Lucas Redding
2015-09-21 13:47           ` Jacob Sparre Andersen
2015-09-21 13:52           ` Georg Bauhaus
2015-09-21 15:54             ` Lucas Redding
2015-09-22 17:49               ` Jacob Sparre Andersen
2015-09-22 18:45               ` Jacob Sparre Andersen
2015-10-01  6:50                 ` Lucas Redding
2015-09-21 16:48       ` Dmitry A. Kazakov
2015-10-01  7:25         ` Lucas Redding
2015-10-01 20:04           ` Randy Brukardt
replies disabled

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