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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,829936167b39e478 X-Google-Attributes: gid103376,public From: jhassett@my-dejanews.com Subject: Re: Incompatibility involving universal expressions Date: 1998/10/12 Message-ID: <6vt19c$2iq$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 400220431 References: <6vj3sb$k7c$1@nnrp1.dejanews.com> X-Http-Proxy: 1.0 x14.dejanews.com:80 (Squid/1.1.22) for client 192.31.86.34 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Oct 12 13:47:23 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (X11; U; SunOS 5.5.1 sun4m) Date: 1998-10-12T00:00:00+00:00 List-Id: Last week I posted a message about what I thought was an Ada 83/ Ada 95 incompatibility I'd run into, and asking if someone could set me straight if I'd misunderstood the situation. It seems that everyone who bothered to read my message was either too busy or too kind to embarrass me with a response, so I'm responding to myself, in case any reader might still be confused. The incompatibility does not exist. The details mainly concern my creative misunderstanding of RM83. I had complained that the following little package spec compiled under the Rational VADS Ada 83 compiler, but not under the Green Hills Ada 95 compiler: with Text_IO; package P is N : constant := 10; type T is new Text_IO.Count range 2 .. N - 1; end P; I'm now convinced that the VADS compiler was in error: the use of "N - 1" above is illegal in both versions of Ada. I had thought that this expression could be implicitly converted from universal_integer to Text_IO.Count in Ada 83, but not in Ada 95. In fact, it cannot be implicitly converted in either language. What I missed was a proper interpretation of this restriction from RM83-4.6(15): An implicit conversion of an operand of type universal_integer to another integer type . . . can only be applied if the operand is either a numeric literal, a named number, or an attribute In other words, more general universal_integer expressions such as "N - 1" are not subject to implicit conversion. I had read the paragraph containing the quoted restriction, but I think I dismissed it with too narrow an interpretation of the word "operand" (which doesn't seem to be defined in RM83). Without much thought, I took this to refer only to actual parameters of subprograms, so I didn't see it as relevant to a bound of a range. (It still isn't clear to me why the quoted restriction uses the word "operand" instead of "expression".) In any event, I'm happy to find that the supposed incompatibility is not real, but I'm chagrined at having been so misled by a faulty compiler. - Jim Hassett -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own