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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Haskell, anyone? Date: Mon, 16 Nov 2015 14:38:55 -0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <87mvue50ey.fsf@ixod.org> <87d1vaoa6y.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 16 Nov 2015 14:38:55 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="da745e888d4a5182b5fda6212bbb0a63"; logging-data="10369"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+84VeFYjpWVKCZNJNAAo89Y2c/mYqDnfY=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:D6gH/tdvC2gpVZE2iZKhlm3wCOc= Xref: news.eternal-september.org comp.lang.ada:28402 Date: 2015-11-16T14:38:55+00:00 List-Id: On Mon, 16 Nov 2015 08:45:32 +0000, Simon Wright wrote: > "Nasser M. Abbasi" writes: >>>gnatmake foo.adb >> gcc-4.8 -c foo.adb foo.adb:8:12: warning: value not in range of type >> "I" defined at line 4 foo.adb:8:12: warning: "Constraint_Error" will be >> raised at run time > > The compiler can only do this because the values and the assignment are > close enough (in the same scope?). How often does this sort of mistake > happen IRL? Often enough to make the warning worthwhile : I've seen it at least once IRL. But you're correct : even passing one of the expression variables in as a parameter is enough to defeat the warning, even whet the actual parameter is a constant - or even a literal. That case too could potentially be warned about, but then you're well into the realm of diminished returns. -- Brian