From: Adam Beneschan <adambeneschan@aol.com>
Subject: Re: How to do null comparision with pointers in ADA83?
Date: Fri, 25 Oct 2013 11:56:22 -0700 (PDT)
Date: 2013-10-25T11:56:22-07:00 [thread overview]
Message-ID: <58d8b0f3-049a-465e-80bf-01b67c761de5@googlegroups.com> (raw)
In-Reply-To: <fc4242f5-91bb-4718-b345-8a0e3aa3dfbf@googlegroups.com>
On Friday, October 25, 2013 11:48:05 AM UTC-7, seshuch...@gmail.com wrote:
If AVL_Node_Ref is declared "type AVL_Node_Ref is private;" in package P, then the only places where the program can tell it's an access type are in the private part of P (after the complete declaration is seen), and in the body of P. (And, in Ada 95+, in some places in child packages.) Here, if you're in another package, it won't be able to tell that AVL_Node_Ref is an access type, even if you say "use P;". It only knows that it's a private type. You should be able to compare two AVL_Node_Refs, since "=" is still defined on private types. But you can't compare an AVL_Node_Ref to null, since it's not allowed to know AVL_Node_Ref is an access type.
When a package declares a private type, it also has to decide what operations on that type it wants to provide for other packages to use. Here, you probably want to declare a function like Is_Null in the public part of the package. Now other packages can use that function without having to know anything about AVL_Node_Ref's full definition.
-- Adam
next prev parent reply other threads:[~2013-10-25 18:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-25 18:12 How to do null comparision with pointers in ADA83? seshucherukuri
2013-10-25 18:18 ` Adam Beneschan
2013-10-25 18:33 ` seshucherukuri
2013-10-25 18:40 ` Adam Beneschan
2013-10-25 18:48 ` seshucherukuri
2013-10-25 18:56 ` Adam Beneschan [this message]
2013-10-25 19:27 ` seshucherukuri
2013-10-25 19:34 ` Adam Beneschan
2013-10-25 19:40 ` Seshu Kumar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox