comp.lang.ada
 help / color / mirror / Atom feed
* Unchecked_Conversion and alignment
@ 2003-01-21  7:01 Victor Porton
  2003-01-21 15:18 ` Stephen Leake
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Victor Porton @ 2003-01-21  7:01 UTC (permalink / raw)


13.9.5 requests "S'Alignment = Target'Alignment" (for source and target 
of Unchecked_Conversion).

So, it appears impossible to keep several objects of arbitrary types in 
an array of an array of System.Storage_Elements.Storage_Array (as these 
alignments are not necessarily equal).

To bad! It would be right to lessen the Standard request to only that
S'Address mod Target'Alignment = 0.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Unchecked_Conversion and alignment
  2003-01-21  7:01 Unchecked_Conversion and alignment Victor Porton
@ 2003-01-21 15:18 ` Stephen Leake
  2003-01-21 15:59   ` Lutz Donnerhacke
  2003-01-21 18:50 ` Victor Porton
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Stephen Leake @ 2003-01-21 15:18 UTC (permalink / raw)


porton@ex-code.com (Victor Porton) writes:

> 13.9.5 requests "S'Alignment = Target'Alignment" (for source and target 
> of Unchecked_Conversion).
> 
> So, it appears impossible to keep several objects of arbitrary types in 
> an array of an array of System.Storage_Elements.Storage_Array (as these 
> alignments are not necessarily equal).
> 
> To bad! It would be right to lessen the Standard request to only that
> S'Address mod Target'Alignment = 0.

You can probably get what you really want via
Address_To_Access_Conversions. 

It would help if you said why you want to keep object in arrays of
Storage_Elements. 

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Unchecked_Conversion and alignment
  2003-01-21 15:18 ` Stephen Leake
@ 2003-01-21 15:59   ` Lutz Donnerhacke
  0 siblings, 0 replies; 11+ messages in thread
From: Lutz Donnerhacke @ 2003-01-21 15:59 UTC (permalink / raw)


* Stephen Leake wrote:
> porton@ex-code.com (Victor Porton) writes:
>> So, it appears impossible to keep several objects of arbitrary types in 
>> an array of an array of System.Storage_Elements.Storage_Array (as these 
>> alignments are not necessarily equal).
>
> You can probably get what you really want via
> Address_To_Access_Conversions.

No. Several architectures gracefully allows misaliged access to structured
data, but this is not generally true. It might cause some nifty errory
especially when timing and access sequences (hardware) are important.

If you want to 'map' data, you have to ensure yourself, that the mapped
structure has an natural alignment of one. Otherwise you have to copy or
reconstruct the data in question from the alignedment independed pieces.

> It would help if you said why you want to keep object in arrays of
> Storage_Elements.

Most cases occurs when reading stream data from network devices.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Unchecked_Conversion and alignment
  2003-01-21  7:01 Unchecked_Conversion and alignment Victor Porton
  2003-01-21 15:18 ` Stephen Leake
@ 2003-01-21 18:50 ` Victor Porton
  2003-01-22 22:49   ` Simon Wright
  2003-01-23 17:11   ` Stephen Leake
  2003-01-21 19:39 ` Robert A Duff
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 11+ messages in thread
From: Victor Porton @ 2003-01-21 18:50 UTC (permalink / raw)


In article <uznpu4jkx.fsf@nasa.gov>,
	Stephen Leake <Stephen.A.Leake@nasa.gov> writes:
> porton@ex-code.com (Victor Porton) writes:
> 
>> 13.9.5 requests "S'Alignment = Target'Alignment" (for source and target 
>> of Unchecked_Conversion).
>> 
>> So, it appears impossible to keep several objects of arbitrary types in 
>> an array of an array of System.Storage_Elements.Storage_Array (as these 
>> alignments are not necessarily equal).
>> 
>> To bad! It would be right to lessen the Standard request to only that
>> S'Address mod Target'Alignment = 0.
> 
> You can probably get what you really want via
> Address_To_Access_Conversions. 

Even worse. Basically Standard warrants getting correct access only
from these  addresses which we got from an access.

> It would help if you said why you want to keep object in arrays of
> Storage_Elements. 

I make my own storage pool which uses the standard pool.

I allocate by "new Storage_Array(1..XXX)".



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Unchecked_Conversion and alignment
  2003-01-21  7:01 Unchecked_Conversion and alignment Victor Porton
  2003-01-21 15:18 ` Stephen Leake
  2003-01-21 18:50 ` Victor Porton
@ 2003-01-21 19:39 ` Robert A Duff
  2003-01-21 19:41 ` Jeffrey Carter
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Robert A Duff @ 2003-01-21 19:39 UTC (permalink / raw)


porton@ex-code.com (Victor Porton) writes:

> 13.9.5 requests "S'Alignment = Target'Alignment" (for source and target 
> of Unchecked_Conversion).
> 
> So, it appears impossible to keep several objects of arbitrary types in 
> an array of an array of System.Storage_Elements.Storage_Array (as these 
> alignments are not necessarily equal).
> 
> To bad! It would be right to lessen the Standard request to only that
> S'Address mod Target'Alignment = 0.

That's a good point.  You should send a comment to the ARG.

- Bob



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Unchecked_Conversion and alignment
  2003-01-21  7:01 Unchecked_Conversion and alignment Victor Porton
                   ` (2 preceding siblings ...)
  2003-01-21 19:39 ` Robert A Duff
@ 2003-01-21 19:41 ` Jeffrey Carter
  2003-01-21 21:04 ` Victor Porton
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Jeffrey Carter @ 2003-01-21 19:41 UTC (permalink / raw)


Victor Porton wrote:
> 
> So, it appears impossible to keep several objects of arbitrary types in 
> an array of an array of System.Storage_Elements.Storage_Array (as these 
> alignments are not necessarily equal).

You can probably get what you want using Ada.Storage_IO.

-- 
Jeff Carter
"That was the most fun I've ever had without laughing."
Annie Hall




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Unchecked_Conversion and alignment
  2003-01-21  7:01 Unchecked_Conversion and alignment Victor Porton
                   ` (3 preceding siblings ...)
  2003-01-21 19:41 ` Jeffrey Carter
@ 2003-01-21 21:04 ` Victor Porton
  2003-01-21 21:15 ` Victor Porton
  2003-01-23 21:03 ` Victor Porton
  6 siblings, 0 replies; 11+ messages in thread
From: Victor Porton @ 2003-01-21 21:04 UTC (permalink / raw)


In article <wcc3cnm8f8o.fsf@shell01.theworld.com>,
	Robert A Duff <bobduff@shell01.TheWorld.com> writes:
> porton@ex-code.com (Victor Porton) writes:
> 
>> 13.9.5 requests "S'Alignment = Target'Alignment" (for source and target 
>> of Unchecked_Conversion).
[skip] 
>> To bad! It would be right to lessen the Standard request to only that
>> S'Address mod Target'Alignment = 0.
> 
> That's a good point.  You should send a comment to the ARG.

Done, well I sent "Target'Alignment = 0 or else Target'Alignment = 0".



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Unchecked_Conversion and alignment
  2003-01-21  7:01 Unchecked_Conversion and alignment Victor Porton
                   ` (4 preceding siblings ...)
  2003-01-21 21:04 ` Victor Porton
@ 2003-01-21 21:15 ` Victor Porton
  2003-01-23 21:03 ` Victor Porton
  6 siblings, 0 replies; 11+ messages in thread
From: Victor Porton @ 2003-01-21 21:15 UTC (permalink / raw)


In article <3E2DA280.70905@acm.org>,
	Jeffrey Carter <jrcarter@acm.org> writes:
> Victor Porton wrote:
>> 
>> So, it appears impossible to keep several objects of arbitrary types in 
>> an array of an array of System.Storage_Elements.Storage_Array (as these 
>> alignments are not necessarily equal).
> 
> You can probably get what you want using Ada.Storage_IO.

Absolutely no: firstly, I need objects of different types, not a 
homogeneous array; secondly, I need accesses to the elements which 
Storage_IO does not provide.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Unchecked_Conversion and alignment
  2003-01-21 18:50 ` Victor Porton
@ 2003-01-22 22:49   ` Simon Wright
  2003-01-23 17:11   ` Stephen Leake
  1 sibling, 0 replies; 11+ messages in thread
From: Simon Wright @ 2003-01-22 22:49 UTC (permalink / raw)


porton@ex-code.com (Victor Porton) writes:

> > It would help if you said why you want to keep object in arrays of
> > Storage_Elements. 
> 
> I make my own storage pool which uses the standard pool.
> 
> I allocate by "new Storage_Array(1..XXX)".

When you are called as

   procedure Allocate (The_Pool : in out Pool;
                       Storage_Address : out System.Address;
                       Size_In_Storage_Elements : SSE.Storage_Count;
                       Alignment : SSE.Storage_Count);

you need to make sure that you allocate enough extra that you can
start the returned Storage_Address at the correct alignment.

Something like

  Size_In_Storage_Elements
    + (Alignment - (Size_In_Storage_Elements mod Alignment))

(I haven't thought about that a lot, let alone tried to compile it).

Of course your system new will give you some alignment for free
(typically 16?)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Unchecked_Conversion and alignment
  2003-01-21 18:50 ` Victor Porton
  2003-01-22 22:49   ` Simon Wright
@ 2003-01-23 17:11   ` Stephen Leake
  1 sibling, 0 replies; 11+ messages in thread
From: Stephen Leake @ 2003-01-23 17:11 UTC (permalink / raw)


porton@ex-code.com (Victor Porton) writes:

> In article <uznpu4jkx.fsf@nasa.gov>,
> 	Stephen Leake <Stephen.A.Leake@nasa.gov> writes:
> > It would help if you said why you want to keep object in arrays of
> > Storage_Elements. 
> 
> I make my own storage pool which uses the standard pool.
> 
> I allocate by "new Storage_Array(1..XXX)".

Ok. The functions for defining storage pools do everything you need
without Unchecked_Conversion, so I don't understand the problem.

Perhaps you could post your code, so I could see what's going on.
-- 
-- Stephe



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Unchecked_Conversion and alignment
  2003-01-21  7:01 Unchecked_Conversion and alignment Victor Porton
                   ` (5 preceding siblings ...)
  2003-01-21 21:15 ` Victor Porton
@ 2003-01-23 21:03 ` Victor Porton
  6 siblings, 0 replies; 11+ messages in thread
From: Victor Porton @ 2003-01-23 21:03 UTC (permalink / raw)


In article <u1y33aizr.fsf@nasa.gov>,
	Stephen Leake <Stephen.A.Leake@nasa.gov> writes:
> porton@ex-code.com (Victor Porton) writes:
> 
>> In article <uznpu4jkx.fsf@nasa.gov>,
>> 	Stephen Leake <Stephen.A.Leake@nasa.gov> writes:
>> > It would help if you said why you want to keep object in arrays of
>> > Storage_Elements. 
>> 
>> I make my own storage pool which uses the standard pool.
>> 
>> I allocate by "new Storage_Array(1..XXX)".
> 
> Ok. The functions for defining storage pools do everything you need
> without Unchecked_Conversion, so I don't understand the problem.
> 
> Perhaps you could post your code, so I could see what's going on.

You are right, there are no problem. My miss.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-01-23 21:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-21  7:01 Unchecked_Conversion and alignment Victor Porton
2003-01-21 15:18 ` Stephen Leake
2003-01-21 15:59   ` Lutz Donnerhacke
2003-01-21 18:50 ` Victor Porton
2003-01-22 22:49   ` Simon Wright
2003-01-23 17:11   ` Stephen Leake
2003-01-21 19:39 ` Robert A Duff
2003-01-21 19:41 ` Jeffrey Carter
2003-01-21 21:04 ` Victor Porton
2003-01-21 21:15 ` Victor Porton
2003-01-23 21:03 ` Victor Porton

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