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: border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: character literals Date: Wed, 12 Feb 2014 00:49:06 +0100 Organization: A noiseless patient Spider Message-ID: <87k3d1qkgd.fsf@ludovic-brenta.org> References: <887860151413854987.949178yaldnif.w-blueyonder.co.uk@news.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx05.eternal-september.org; posting-host="629726c312d913580947e7a8ebe951ea"; logging-data="7328"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ugZtdDCy4O9gu5n40PYUI" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:p2pmEHNojGm79UZZmlQg/V+MmE8= sha1:8ulkE+Ka09P4I88W5GuwYwBGpbQ= Xref: number.nntp.dca.giganews.com comp.lang.ada:184792 Date: 2014-02-12T00:49:06+01:00 List-Id: Bill Findlay writes on comp.lang.ada: > "J-P. Rosen" wrote: >> Le 11/02/2014 23:27, agent@drrob1.com a écrit : >>> I have been having a difficulty in my code with character literals. >>> For example >>> >>> IF ch in '0' .. '9' THEN >>> >>> This gives an error because the compiler is complaining that it does >>> not know if I mean a character, wide_character, or wide_wide_character >>> for my literals. How do I indicate which I want? >>> >> if Ch in Character range '0' .. '9' then >> >> Ada recognizes types by name. There are a few cases (like this one) >> where the designers tried to save some typing by allowing the type to be >> inferred from the values; it is almost always a bad idea, and it is >> always possible to state the type explicitely. > > Why is the literal type not inferred from the type of Ch in this case? Because it's the other way around :) the type of Ch is inferred from the type of the range. -- Ludovic Brenta.