comp.lang.ada
 help / color / mirror / Atom feed
From: adam.betts155@gmail.com
Subject: Anonymous access types
Date: Fri, 08 Jun 2007 02:29:48 -0700
Date: 2007-06-08T02:29:48-07:00	[thread overview]
Message-ID: <1181294988.270499.202550@g4g2000hsf.googlegroups.com> (raw)

I am having some trouble with anonymous access types, behaviour which
I do not understand. I have 2 questions:

1) This one is bizarre and quite non-deterministic. I *sometimes* get
a "finalize/adjust raised exception" with the following bit of code:

declare
      t_ptr : tree_pointer := new tree'(get_tree(g));
      anon_t_ptr : access tree'class := new tree'(get_tree(g));
      lca : least_common_ancestor(anon_t_ptr);
begin
end;

with the following type declarations:
 tree_pointer is access tree'class;
 type least_common_ancestor (tree_ptr: access constant tree'class);

It seems that there is sometimes a problem with the lca declaration,
since the exception is never raised when anon_t_ptr is replaced with
t_ptr.

2) I want to return an anonymous access type from a function:

function get_tree (g: graph) return non null access tree is
begin
  return new tree(g.t);
end get_tree;

The access type is not null when I use this function. However, when I
run the code and try to do operations on the access type, it is not
pointing in the right place. For example, the returned tree does not
have vertices and edges even though I know it does.

Any help with either of these issues would be greatly appreciated.




             reply	other threads:[~2007-06-08  9:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-08  9:29 adam.betts155 [this message]
2007-06-08 12:01 ` Anonymous access types Dmitry A. Kazakov
2007-06-08 12:09   ` adam.betts155
2007-06-08 18:08     ` Dmitry A. Kazakov
replies disabled

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