comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Unchecked_Conversion and alignment
Date: 22 Jan 2003 22:49:08 +0000
Date: 2003-01-22T22:49:08+00:00	[thread overview]
Message-ID: <x7v3cnkby1n.fsf@smaug.pushface.org> (raw)
In-Reply-To: 3e2da295$0$33922$bed64819@news.gradwell.net

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?)



  reply	other threads:[~2003-01-22 22:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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
replies disabled

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