comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adambeneschan@aol.com>
Subject: Re: How to do null comparision with pointers in ADA83?
Date: Fri, 25 Oct 2013 11:18:38 -0700 (PDT)
Date: 2013-10-25T11:18:38-07:00	[thread overview]
Message-ID: <54232277-979e-4e76-af20-566903cac3de@googlegroups.com> (raw)
In-Reply-To: <5bae226f-91a2-4da0-a802-185a0de514f3@googlegroups.com>

On Friday, October 25, 2013 11:12:00 AM UTC-7, seshuch...@gmail.com wrote:
> Hello,
> 
> In ADA83, i could not able to do null comparision of my pointer value.
> here, my pointer is of array type.
> 
> Is there any solution for this.
> 
> Thanking you in advance.

We really need to see the code.  But here's my first guess: When you declare an access type in a package, the "=" operator that lets you compare values of the access type is also declared in the same package.  In another package, you can't use the "=" operator unless the names in the first package are visible.  So this won't work if you're not inside package P:

    Acc : P.Access_Type;
begin
    if Acc = null then ...

You'd need to either put "use P;" somewhere, or do something like this:

    if P."=" (Acc, null) then ...

or you could use a rename to make "=" visible if you don't want to use "use P":

    function "=" (Left, Right : P.Access_Type) return boolean
        renames P."=";

and now you can use = as an operator everywhere that this renaming declaration is visible.

If this isn't the problem, then I think we need to see some code.

                                    -- Adam



  reply	other threads:[~2013-10-25 18:18 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 [this message]
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
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