comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Bug in Ada (SuSe 10.2) ?
Date: Fri, 22 Feb 2008 13:52:11 -0600
Date: 2008-02-22T13:52:11-06:00	[thread overview]
Message-ID: <fpne5k$qab$1@jacob-sparre.dk> (raw)
In-Reply-To: 69019a65-736e-48ee-bd9f-4c29cd7fc88f@72g2000hsu.googlegroups.com

<billjones6789@yahoo.com> wrote in message
news:69019a65-736e-48ee-bd9f-4c29cd7fc88f@72g2000hsu.googlegroups.com...
>On Feb 21, 2:32 pm, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
>> We're talking about language-defined checks. There are no
language-defined
>> checks for dangling pointers!
>
>Huh?
>In Ada83 there was no provision for pointers into the stack, because
>of the well-known danger of leaving a dangling pointer when the
>subprogram exited.  Ada95 considered it necessary to allow pointers
>into the stack, in part because users were doing it anyway (using
>unsafe techniques like 'address and Unchecked_Conversion) to avoid
>the well-known dangers of using heap allocation.
>
>To eliminate the danger of dangling pointers into the stack, Ada95
>introduced the concept of Accessibility_Check, which, like
>Overflow_Check, can be controlled using pragma Suppress/Unsuppress,
>and possibly compiler switches.

These aren't "dangling pointer" checks (which would occur on the
dereference). If you wanted to talk about them informally, I'd call them
"lifetime" checks, but it is best to call them by their real name (which you
finally did above). I thought you were talking about something completely
different.

Anyway, accessibility checks contain both a static and dynamic part, and it
is fairly difficult to write an interesting program that passes the static
check and fails the dynamic check. The most likely way to do so in practice
is to use an anonymous access parameter -- and this is the best reason for
avoiding such parameters, as you have the possibility of failure just
because you are making a call from a nested location.

And, yes, I suppose you could suppress the check. You could also play
Russian Roulette. Or, most likely, you'll have used 'Unchecked_Access to
avoid that silly check in the first place (it prevents lots of things that
are safe to do). But you still would have been better off avoiding the
unchecked access in the first place, because eliminating the check would not
eliminate most of the overhead (that overhead can only be eliminated if the
subprogram body and all calls are compiled such that it is certain that the
check is suppressed and cannot be turned back on -- which means that any
separate compilation eliminates that possibility).

In any case, there is nothing wrong with having the ability to suppress
language-defined checks via a compiler switch or whatever. But there is
something wrong with having the default operation of a compiler having those
checks suppressed. Yes, pendantically this is OK, but it means that new
users don't actually use the Ada standard mode.

                                           Randy.



Of course, the danger is only eliminated when this language-defined
check is fully implemented in standard mode.





  parent reply	other threads:[~2008-02-22 19:52 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19  8:47 Bug in Ada (SuSe 10.2) ? Reinert Korsnes
2008-02-19  9:08 ` Niklas Holsti
2008-02-19  9:53   ` Reinert Korsnes
2008-02-19 11:21     ` Ludovic Brenta
2008-02-20 12:41       ` Reinert Korsnes
2008-02-20 16:50         ` Adam Beneschan
2008-02-20 18:31           ` Jeffrey R. Carter
2008-02-20 23:10             ` Adam Beneschan
2008-02-20 23:22             ` Adam Beneschan
2008-02-21  0:31               ` Randy Brukardt
2008-02-21  8:56                 ` Jean-Pierre Rosen
2008-02-21  9:08                   ` Alex R. Mosteo
2008-02-21  9:27                     ` Ludovic Brenta
2008-02-21  9:46                       ` billjones6789
2008-02-21 12:27                         ` Access type (mis)use (Was: Bug in Ada (SuSe 10.2) ?) Jacob Sparre Andersen
2008-02-21 19:40                           ` Bob Klungle
2008-02-21 21:25                             ` Jeffrey R. Carter
2008-02-21 21:57                             ` Vadim Godunko
2008-02-21 22:32                         ` Bug in Ada (SuSe 10.2) ? Randy Brukardt
2008-02-22 16:10                           ` billjones6789
2008-02-22 19:21                             ` Georg Bauhaus
2008-02-22 21:29                               ` Vadim Godunko
2008-02-22 21:39                                 ` Robert A Duff
2008-02-23 10:16                               ` billjones6789
2008-02-22 19:52                             ` Randy Brukardt [this message]
2008-02-23 10:36                               ` billjones6789
2008-02-26  0:32                                 ` Randy Brukardt
2008-02-26 16:46                                   ` billjones6789
2008-02-26 20:53                                     ` Randy Brukardt
2008-02-27  1:05                                     ` Robert A Duff
2008-02-27 10:06                                       ` billjones6789
2008-02-27 17:49                                         ` Robert A Duff
2008-02-28  0:30                                           ` Randy Brukardt
2008-02-28 15:33                                             ` Robert A Duff
2008-03-06 17:46                                             ` Adam Beneschan
2008-02-21  0:31               ` Jeffrey R. Carter
2008-02-21  0:35                 ` Jeffrey R. Carter
2008-03-06 11:55                   ` Colin Paul Gloster
2008-02-21  0:55               ` tmoran
2008-02-21  8:08                 ` billjones6789
2008-02-21  9:11                 ` Alex R. Mosteo
2008-02-21 23:01                   ` Randy Brukardt
2008-02-22 16:43                 ` Adam Beneschan
2008-02-22  9:06               ` Stephen Leake
2008-02-22  5:40       ` Gautier
replies disabled

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