comp.lang.ada
 help / color / mirror / Atom feed
* How to prevent 'Unchecked_Access
@ 1996-10-22  0:00 Geert Bosch
  1996-10-23  0:00 ` Robert A Duff
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Bosch @ 1996-10-22  0:00 UTC (permalink / raw)



OK, as long as there is no GC for GNAT I'd like to use the stack
whereever I can to prevent errors in memory management. Sadly
enough there are many times I need to pass access types to procedures
at library level, notably OS and GUI libraries. 

Although I understand the use of Ada-95 accessibility levels to
prevent dangling pointers (dangling access objects???), there are
many times Unchecked_Access is necessary to pass parameters to
a subprogram that is known not to secretly store it somewhere for
later reuse.

Isn't there a way to express this safe behavior at the subprogram, so
they can be used without using Unchecked_Access. A pragma specifying
that an access-type parameter is limited would seem logical.

For those who might think that this question falls into the
category "how do I turn this screw without using the screwdriver",
I'd like to point out that the situation I describe doesn't
have to be "Unchecked".

Subprograms that take these limited access types as parameters can be
checked at compile time so there is nothing Unchecked taking place.
Reserving a dangerous feature for places which *are* potentially
dangerous is better IMHO that using it all over the place.

Of course specifying the pragma for imported C functions is
potentially unsafe, but importing C functions was unsafe 
already.

I'm very interested in your opinions on this.
-- 
E-Mail: geert@sun3.iaf.nl    




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

end of thread, other threads:[~1996-10-23  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-10-22  0:00 How to prevent 'Unchecked_Access Geert Bosch
1996-10-23  0:00 ` Robert A Duff

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