From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e408bb0b4469b67c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!79g2000cws.googlegroups.com!not-for-mail From: msimonides@power.com.pl Newsgroups: comp.lang.ada Subject: Re: Default comparison of tagged variant records Date: 10 Dec 2006 23:40:51 -0800 Organization: http://groups.google.com Message-ID: <1165822851.141177.13460@79g2000cws.googlegroups.com> References: <1165585768.342140.201110@16g2000cwy.googlegroups.com> <1165602630.553040.134960@n67g2000cwd.googlegroups.com> NNTP-Posting-Host: 62.111.211.178 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1165822857 29264 127.0.0.1 (11 Dec 2006 07:40:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 11 Dec 2006 07:40:57 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.02 (X11; Linux i686; U; en),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: 79g2000cws.googlegroups.com; posting-host=62.111.211.178; posting-account=YHdqRw0AAAAIPYzcJprg4QGlRlBwcPu_ Xref: g2news2.google.com comp.lang.ada:7881 Date: 2006-12-10T23:40:51-08:00 List-Id: Randy Brukardt napisal(a): > "Adam Beneschan" 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&