comp.lang.ada
 help / color / mirror / Atom feed
* Thin pointers and the GNAT RM
@ 2001-02-02 15:05 Marc A. Criley
  2001-02-02 16:43 ` Marc A. Criley
  0 siblings, 1 reply; 2+ messages in thread
From: Marc A. Criley @ 2001-02-02 15:05 UTC (permalink / raw)


While perusing the super-secret GNAT 3.13p Reference Manual to detemine
how to force a pointer to an unconstrained array to use a "thin"
pointer, I found exactly what I was looking for:

To specify a thin pointer, use a size clause for the type, for example: 

     type X is access all String;
     for X'Size use System.Address'Size;

However, employing this approach in a test program...

-------------------------------------------
with System;

procedure Pt is

   type X is access all String;
   for X'Size use System.Address'Size;

begin
   null;
end Pt;
--------------------------------------------

...produces the following error message:

pt.adb:6:33: static integer expression required here

By replacing "System.Address'Size" with 32, the code compiles and works
correctly.

(This information is also being sent to report@gnat.com.)


Marc A. Criley
Senior Staff Engineer
Quadrus Corporation
www.quadruscorp.com



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

* Re: Thin pointers and the GNAT RM
  2001-02-02 15:05 Thin pointers and the GNAT RM Marc A. Criley
@ 2001-02-02 16:43 ` Marc A. Criley
  0 siblings, 0 replies; 2+ messages in thread
From: Marc A. Criley @ 2001-02-02 16:43 UTC (permalink / raw)


I've been informed that the GNAT RM is in error, the correct clause uses
Standard'Address_Size:

  type X is access all String;
  for X'Size use Standard'Address_Size;

Marc

"Marc A. Criley" wrote:
> 
> While perusing the super-secret GNAT 3.13p Reference Manual to detemine
> how to force a pointer to an unconstrained array to use a "thin"
> pointer, I found exactly what I was looking for:
> 
> To specify a thin pointer, use a size clause for the type, for example:
> 
>      type X is access all String;
>      for X'Size use System.Address'Size;
> 
> However, employing this approach in a test program...
> 
> -------------------------------------------
> with System;
> 
> procedure Pt is
> 
>    type X is access all String;
>    for X'Size use System.Address'Size;
> 
> begin
>    null;
> end Pt;
> --------------------------------------------
> 
> ...produces the following error message:
> 
> pt.adb:6:33: static integer expression required here
> 
> By replacing "System.Address'Size" with 32, the code compiles and works
> correctly.
> 
> (This information is also being sent to report@gnat.com.)
> 
> Marc A. Criley
> Senior Staff Engineer
> Quadrus Corporation
> www.quadruscorp.com



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

end of thread, other threads:[~2001-02-02 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-02 15:05 Thin pointers and the GNAT RM Marc A. Criley
2001-02-02 16:43 ` Marc A. Criley

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