comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Problems with GLUT on NT and "deeper accessibility"
Date: 1998/10/30
Date: 1998-10-30T00:00:00+00:00	[thread overview]
Message-ID: <wccogqtvg6f.fsf@world.std.com> (raw)
In-Reply-To: 3639E95B.3CD1F79D@ilt.fhg.de

Rolf Wester <WESTER@ilt.fhg.de> writes:

> Could you or anyone else tell an Ada novice why the program does'nt work with
> "access" but with "Unchecked_Access"? When I define my own "my_ac_GLfloat" in the
> same way  "ac_GLfloat"  is defined in win32.gl it works with "access".

The accessibility rules are intended to prevent dangling pointers,
unless you use one of the Unchecked_... features.  Mostly, these rules
are checked at compile time, which means they are necessarily
conservative.

You were able to create a pointer of type my_ac_GLfloat using 'Access
because that access type is nested inside the procedure -- it has the
same lifetime as the object, so it's impossible to assign those pointers
into globals.  The type ac_GLfloat, OTOH, is more global -- if you could
use 'Access to make a pointer of type ac_GLfloat pointing to a local,
then when the procedure returns, that pointer could remain -- it's a
dangling pointer.

Note that if you tried to do a type conversion from my_ac_GLfloat to
ac_GLfloat, you would get the same error, for the same reason.

Does glLightfv save that pointer?  If so, you had better not use
'Unchecked_Access -- you better move your data to a global place, or put
it on the heap.  It not, you can use 'Unchecked_Access.

- Bob
-- 
Change robert to bob to get my real email address.  Sorry.




      reply	other threads:[~1998-10-30  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-30  0:00 Problems with GLUT on NT and "deeper accessibility" Rolf Wester
1998-10-30  0:00 ` David C. Hoos, Sr.
1998-10-30  0:00 ` Matthew Heaney
1998-10-30  0:00   ` Rolf Wester
1998-10-30  0:00     ` Robert A Duff [this message]
replies disabled

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