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,f712c3cc98e7f25 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!a9g2000prl.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: not X'Length Date: Thu, 15 May 2008 15:20:51 -0700 (PDT) Organization: http://groups.google.com Message-ID: <717bf87e-b8b6-4129-8051-7bd45cf2f7b2@a9g2000prl.googlegroups.com> References: <482c0030$0$7542$9b4e6d93@newsspool1.arcor-online.net> <954e4cd2-11a9-420b-85c4-7741c429e1b2@c65g2000hsa.googlegroups.com> <482ca195$0$6788$9b4e6d93@newsspool2.arcor-online.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1210890052 16965 127.0.0.1 (15 May 2008 22:20:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 15 May 2008 22:20:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a9g2000prl.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:83 Date: 2008-05-15T15:20:51-07:00 List-Id: On May 15, 1:48 pm, Georg Bauhaus wrote: > christoph.gr...@eurocopter.com wrote: > > From RM 4.4 follows that this is equivalent to > > > if (not X'Length) in Positive then > > > Now Universal_Integer (X'Length is of this type) has no operators, so > > it has to be converted to an appropriate type. This is Integer (or, to > > be very precise, the type of Integer) in this case. But then there is > > no "not" defined for this type. So the compiler is correct. > > While the compilers are correct, on the programmer's part the > issue is not that easy to understand in general. > You have demonstrated why this is so. Hence my original > question about programmer expectations regarding improved > compiler's diagnostics in this case. You may be right that a better diagnostic would help in this specific case. But a programmer cannot expect a compiler to be a mind-reader. And a compiler writer can't really go through every possible weird combination of things to figure out what sorts of accidental trouble a programmer could get themselves into---there are just too many possibilities. About all a compiler writer can do is respond to particular situations when they get noticed. So go ahead and file your enhancement request, but please don't criticize the compiler (or the vendor) next time you screw up in a different way and the compiler can't figure out what you're trying to do. That would be asking far too much. Your original post said something about expecting the compiler to complain about "not" being applied to a universal integer. I'm not quite sure what your intent was, but applying "not" to a universal integer is quite legitimate where modular types are concerned. Something like (Z and not 1) is a good way to clear a bit in Z, if Z's type is a modular type. Maybe applying "not" to an attribute that returns a universal integer (like "not X'Length") is less legitimate---but even then, if X'Length is known to be a power of 2, something like (not (X'Length-1)) can be used to yield a mask that can be used for alignment/rounding when AND'ed with another modular value. -- Adam