comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier write-only <gautier_niouzes@hotmail.com>
Subject: Re: acceess problem
Date: Tue, 26 Jul 2011 08:57:08 -0700 (PDT)
Date: 2011-07-26T08:57:08-07:00	[thread overview]
Message-ID: <8727ccd3-d7e9-4d41-b55c-9c3d4fba1a78@df3g2000vbb.googlegroups.com> (raw)
In-Reply-To: m24o2azrwb.fsf@pushface.org

On 25 juil, 10:27, Simon Wright <si...@pushface.org> wrote:

> Replace 'Access with 'Unchecked_Access or, if that doesn't work, with
> the (GNAT-special) 'Unrestricted_Access.

Unless 'Unrestricted_Access has been inbetween added to the language,
there is a way to have it in a pure Ada form:

  function Cvt is new
Ada.Unchecked_Conversion(System.Address,DoublePtr);
  -- This method is functionally identical as GNAT's
Unrestricted_Access
  -- but has no type safety (cf GNAT Docs)
  pragma No_Strict_Aliasing(DoublePtr); -- recommended by GNAT 2005

  procedure Vertex (v: Double_vector_3D) is
  begin
    Vertex3dv(Cvt(v(0)'Address));
  end Vertex;

^this is an excerpt from an existing GL binding (why reinvent it?)...
http://globe3d.svn.sourceforge.net/viewvc/globe3d/bindings/gl.adb?revision=152&view=markup

______________________________________________________________________________
Gautier's Ada programming -- http://gautiersblog.blogspot.com/search/label/Ada
NB: follow the above link for a valid e-mail address



  parent reply	other threads:[~2011-07-26 15:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-24 15:59 acceess problem ldries46
2011-07-24 17:27 ` Simon Wright
2011-07-25  6:57   ` ldries46
2011-07-25  8:27     ` Simon Wright
2011-07-25  9:59       ` ldries46
2011-07-26 15:57       ` Gautier write-only [this message]
2011-07-26 17:43         ` Adam Beneschan
2011-07-27 12:06           ` Gautier write-only
2011-07-25  9:08     ` AdaMagica
replies disabled

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