comp.lang.ada
 help / color / mirror / Atom feed
From: Jerry <lanceboyle@qwest.net>
Subject: Re: GNAT 4.2.3 Ubuntu reports weird compile error wrt Unchecked_Access
Date: Sun, 17 Aug 2008 14:14:40 -0700 (PDT)
Date: 2008-08-17T14:14:40-07:00	[thread overview]
Message-ID: <5237f306-275c-4085-971d-1b967a8f055b@v16g2000prc.googlegroups.com> (raw)
In-Reply-To: gf%pk.166003$102.49824@bgtnsc05-news.ops.worldnet.att.net

On Aug 17, 12:47 pm, a...@anon.org (anon) wrote:
> Addition:
>
> The problem is that local data is stored on the primary stack and if an error
> is encounter the exception handlers could remove the local data off the stack,
> creating a 'dangling references.'. Which would makes the pointer (Access
> variable) invalid or unsafe.
>
> So, you must use the "Unchecked_Access" for local data and the programmer
> is responsible for catching any exceptions or other conditions that might
> cause a 'dangling reference.'
>
> Also, because of the specs refering to "Access" and "Unchecked_Access"
> in both Ada_95 and Ada_2005 is basically unchanged you can use
> "Unchecked_Access" instead of "Access" but be warned you must insure
> the code is safe.
>
> And any GNAT that does not support this type of safety should be concerned
> as corrupt and unusable.
>
> PS.  As for Ada-83, the answer is no!  "Unchecked_Access" was added
> during the creation of Ada-95.
>
> In <37Ppk.5180$Mh5.1...@bgtnsc04-news.ops.worldnet.att.net>, a...@anon.org (anon) writes:
>

Thanks for clarifying the availability of 'Unchecked_Access across
language versions.

I have a fair grasp of the accessibility rules for access variables
(although I struggle with it sometimes). However, my original post was
not a question of how to use them per se, but about an apparent
compiler error on a particular version of GNAT on Ubuntu.

FWIW, I moved the declaration of Temp_C_String to the same place where
its type is declared and am now able to use 'Access, as in
Temp_C_String'Access. The developer who originally reported the
problem has responded to me that this has allowed the compilation to
progress normally. Given that, I probably won't pursue this too much
farther, but nevertheless, there might be some interest by others in
discovering if this possible compiler mistake is important enough to
chase down and fix.

Jerry



  reply	other threads:[~2008-08-17 21:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15 20:26 GNAT 4.2.3 Ubuntu reports weird compile error wrt Unchecked_Access Jerry
2008-08-16 10:26 ` Ludovic Brenta
2008-08-16 10:35   ` Ludovic Brenta
2008-08-17  0:03   ` Jerry
2008-08-17 17:14     ` Simon Wright
2008-08-17 21:05       ` Jerry
2008-08-17  5:59 ` anon
2008-08-17 19:47   ` anon
2008-08-17 21:14     ` Jerry [this message]
2008-08-17 20:58   ` Jerry
replies disabled

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