comp.lang.ada
 help / color / mirror / Atom feed
* Re: Unchecked_Deallocation and Constraint_Error
@ 2002-02-19 12:13 Christoph Grein
  2002-02-19 12:54 ` Florian Weimer
  0 siblings, 1 reply; 10+ messages in thread
From: Christoph Grein @ 2002-02-19 12:13 UTC (permalink / raw)


> > ...
> >   Cmd : Integer_Array_Access := new Integer_Array(1..1);
> > ...
> >    Free(Cmd);
> >    Cmd(1) := 1;
> > ...
> >
> > Program should throw exception Constraint_Error, but it only
> > hangs at instruction Cmd(1) := 1; (but doesn't quit).
> 
> The Reference Manual is quite clear (section 13.11.2):
> 
> |                           _Erroneous Execution_
> |
> | 16. Evaluating a name that denotes a nonexistent object is erroneous.
> 
> You cannot expect that a Constraint_Error exception is raised in this
> case, unless your compiler documentation guarantees this.

That's correct, but 13.11.2(7) specifies that the value of Cmd is null after UD 
(I assume Free is an instantiation of UD), so a dereference Cmd(1) must raise 
CE, except 
when checks are suppressed.



^ permalink raw reply	[flat|nested] 10+ messages in thread
* Unchecked_Deallocation and Constraint_Error
@ 2002-02-19 11:11 Michal Nowikowski
  2002-02-19 11:59 ` Florian Weimer
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Nowikowski @ 2002-02-19 11:11 UTC (permalink / raw)


Hello

I've got some code like that:

...
  Cmd : Integer_Array_Access := new Integer_Array(1..1);
...
   Free(Cmd);
   Cmd(1) := 1;
...

Program should throw exception Constraint_Error, but it only
hangs at instruction Cmd(1) := 1; (but doesn't quit). Do you
know whats going on and how to push it to throw exception naturally.

Best Regards
Godfryd

-- 
|  Michal Nowikowski <godfryd@zamek.gda.pl>
|  BOFH excuse #190: Proprietary Information.



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

end of thread, other threads:[~2002-02-26 22:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-19 12:13 Unchecked_Deallocation and Constraint_Error Christoph Grein
2002-02-19 12:54 ` Florian Weimer
2002-02-19 14:15   ` Marin David Condic
2002-02-20 18:59     ` Robert Dewar
2002-02-20 22:45       ` Marin David Condic
2002-02-26 22:37     ` Michal Nowikowski
  -- strict thread matches above, loose matches on Subject: below --
2002-02-19 11:11 Michal Nowikowski
2002-02-19 11:59 ` Florian Weimer
2002-02-19 16:34   ` Jim Gleason
2002-02-19 23:23   ` Robert Dewar

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