* Boolean Operation on pointer (access)
@ 2002-10-26 23:15 Dominic D'Apice
2002-10-27 1:07 ` Robert A Duff
0 siblings, 1 reply; 5+ messages in thread
From: Dominic D'Apice @ 2002-10-26 23:15 UTC (permalink / raw)
Hi,
When i try to do this :
x := ppp (x,z); --where x is a access type and ppp return a access
if (x /= null) then --the line where the compiler stop
zzz (x,z);
else
aaa (q,r);
end if;
I got this error :
gerer_location.ada: Error: line 136 col 23 LRM:8.4(1),
Binary operator "/=" not directly visible, use clause or conversion
might be needed
The operation "/=" should be permit on pointer, then why i got this
error ?
Thanks
Dominic
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Boolean Operation on pointer (access)
2002-10-26 23:15 Boolean Operation on pointer (access) Dominic D'Apice
@ 2002-10-27 1:07 ` Robert A Duff
2002-10-27 1:26 ` Dominic D'Apice
0 siblings, 1 reply; 5+ messages in thread
From: Robert A Duff @ 2002-10-27 1:07 UTC (permalink / raw)
"Dominic D'Apice" <dapiced@sympatico.ca> writes:
> if (x /= null) then --the line where the compiler stop
...
> I got this error :
>
> gerer_location.ada: Error: line 136 col 23 LRM:8.4(1),
> Binary operator "/=" not directly visible, use clause or conversion
> might be needed
>
> The operation "/=" should be permit on pointer, then why i got this
> error ?
You want a "use type" clause on the pointer type.
Yes, "/=" is allowed on pointers, but this operator is implicitly
declared at a certain place in the program, and you need to make it
directly visible in order to call it.
- Bob
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Boolean Operation on pointer (access)
2002-10-27 1:07 ` Robert A Duff
@ 2002-10-27 1:26 ` Dominic D'Apice
2002-10-27 2:02 ` Robert A Duff
2002-10-27 2:17 ` Jeffrey Carter
0 siblings, 2 replies; 5+ messages in thread
From: Dominic D'Apice @ 2002-10-27 1:26 UTC (permalink / raw)
Ok then, i use the clause use in my .ada for my package ads, it's
working,
but i don't understand why i need to put a use clause for only this king
of operator ?
For the rest of my .ada program i only precede each thing by the .ads
package name
Ex : package.var := xxx;
Thanks
Dominic
-----Original Message-----
From: comp.lang.ada-admin@ada.eu.org
[mailto:comp.lang.ada-admin@ada.eu.org] On Behalf Of Robert A Duff
Sent: 26 octobre, 2002 21:08
To: comp.lang.ada@ada.eu.org
Subject: Re: Boolean Operation on pointer (access)
"Dominic D'Apice" <dapiced@sympatico.ca> writes:
> if (x /= null) then --the line where the compiler stop
...
> I got this error :
>
> gerer_location.ada: Error: line 136 col 23 LRM:8.4(1),
> Binary operator "/=" not directly visible, use clause or conversion
> might be needed
>
> The operation "/=" should be permit on pointer, then why i got this
> error ?
You want a "use type" clause on the pointer type.
Yes, "/=" is allowed on pointers, but this operator is implicitly
declared at a certain place in the program, and you need to make it
directly visible in order to call it.
- Bob
_______________________________________________
comp.lang.ada mailing list
comp.lang.ada@ada.eu.org
http://ada.eu.org/mailman/listinfo/comp.lang.ada
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Boolean Operation on pointer (access)
2002-10-27 1:26 ` Dominic D'Apice
@ 2002-10-27 2:02 ` Robert A Duff
2002-10-27 2:17 ` Jeffrey Carter
1 sibling, 0 replies; 5+ messages in thread
From: Robert A Duff @ 2002-10-27 2:02 UTC (permalink / raw)
"Dominic D'Apice" <dapiced@sympatico.ca> writes:
> Ok then, i use the clause use in my .ada for my package ads, it's
> working,
> but i don't understand why i need to put a use clause for only this king
> of operator ?
>
> For the rest of my .ada program i only precede each thing by the .ads
> package name
> Ex : package.var := xxx;
You could say:
if Package_Name."/="(X, null) then...
but you wouldn't want to. You want to say:
if X /= null then...
which is equivalent to:
if "/="(X, null) then ...
so you need the "use type". Does that make sense?
- Bob
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Boolean Operation on pointer (access)
2002-10-27 1:26 ` Dominic D'Apice
2002-10-27 2:02 ` Robert A Duff
@ 2002-10-27 2:17 ` Jeffrey Carter
1 sibling, 0 replies; 5+ messages in thread
From: Jeffrey Carter @ 2002-10-27 2:17 UTC (permalink / raw)
Dominic D'Apice wrote:
> Ok then, i use the clause use in my .ada for my package ads, it's
> working,
> but i don't understand why i need to put a use clause for only this king
> of operator ?
>
> For the rest of my .ada program i only precede each thing by the .ads
> package name
> Ex : package.var := xxx;
The things in a package mentioned in a context clause ("with") are not
directly visible. This means you have to precede them with the package
name to reference them.
You can make everything in a package directly visible by naming the
package in a use clause. Instead of
X : Package_Name.Var;
X := Package_Name."+" (X, 1);
you can have
use Package_Name;
X : Var;
X := X + 1;
This is not always desirable. To only make the operators of a specific
type from the package visible, you can name the type in a "use type" clause:
use type Package_Name.Var;
X : Package_Name.Var; -- "Package_Name." needed here
X := X + 1; -- "+" is an operator for Var, so not needed here
--
Jeff Carter
"Why don't you bore a hole in yourself and let the sap run out?"
Horse Feathers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-10-27 2:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-26 23:15 Boolean Operation on pointer (access) Dominic D'Apice
2002-10-27 1:07 ` Robert A Duff
2002-10-27 1:26 ` Dominic D'Apice
2002-10-27 2:02 ` Robert A Duff
2002-10-27 2:17 ` Jeffrey Carter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox