comp.lang.ada
 help / color / mirror / Atom feed
From: msimonides@power.com.pl
Subject: Re: Default comparison of tagged variant records
Date: 10 Dec 2006 23:40:51 -0800
Date: 2006-12-10T23:40:51-08:00	[thread overview]
Message-ID: <1165822851.141177.13460@79g2000cws.googlegroups.com> (raw)
In-Reply-To: ZOCdnbGHa5HOjufYnZ2dnUVZ_tCtnZ2d@megapath.net


Randy Brukardt napisal(a):
> "Adam Beneschan" <adam@irvine.com> wrote in message
> news:1165602630.553040.134960@n67g2000cwd.googlegroups.com...

> > This looks like a compiler bug to me.  It should return TRUE in those
> > all cases.
>
> I agree with Adam that it *looks* like a compiler bug. OTOH, I tried it on
> Janus/Ada and it also gave FALSE. Something else is going on...
>
> ...(much later)...
>
> The Janus/Ada issue looks like a compiler bug. The fact that
> Unbounded_String is not visibly tagged is fooling the compiler into using
> the predefined rather than the primitive equality. There is code to handle
> this, but it doesn't work. The direct call to "=" works right.

Yes, there was a discussion on this topic on this group some ten years
ago, I should've referred to it in  my post: "Equality on
Ada.Strings.Unbounded" [1] that mentioned this.

> ...(much, much later)...
>
> ...and so does the call to "=". Your program should print TRUE and this is
> clearly a Gnat bug. ;-)

Do you mean comparing the Unbounded_String components of record? This
works in Gnat too and I've used it to define equality for the
troublesome type as a workaround.

> (If anyone cares, the problem with Janus/Ada was that it was not picking up
> the primitive "=" for the untagged private type Unbounded_String, as it was
> only looking for primitive *dispatching* operations. Thus it was using the
> predefined one, and that always returned False unless the objects were the
> same object. Gnat's problem may very well be different.)

In GNAT "=" also returns True when comparing the same object with
itself.

It looks like there might be some explanation that has its roots
somewhere in ARM, that's why I asked.

Thanks for your time.
--
Marcin Simonides

[1]
http://groups.google.com/group/comp.lang.ada/browse_thread/thread/7ff7c4bb20276552/40a0d3db1f82b6c0?q=ada+unbounded+string+equality&lnk=ol&hl=pl&




  reply	other threads:[~2006-12-11  7:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-08 13:49 Default comparison of tagged variant records msimonides
2006-12-08 18:30 ` Adam Beneschan
2006-12-09  1:38   ` Randy Brukardt
2006-12-11  7:40     ` msimonides [this message]
2006-12-11 23:12       ` Randy Brukardt
replies disabled

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