comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: character literals
Date: Wed, 12 Feb 2014 00:49:06 +0100
Date: 2014-02-12T00:49:06+01:00	[thread overview]
Message-ID: <87k3d1qkgd.fsf@ludovic-brenta.org> (raw)
In-Reply-To: 887860151413854987.949178yaldnif.w-blueyonder.co.uk@news.individual.net

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.


  reply	other threads:[~2014-02-11 23:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 22:27 character literals agent
2014-02-11 22:49 ` J-P. Rosen
2014-02-11 23:45   ` Bill Findlay
2014-02-11 23:49     ` Ludovic Brenta [this message]
2014-02-11 23:58       ` adambeneschan
2014-02-11 23:56 ` adambeneschan
2014-02-12  0:18   ` adambeneschan
2014-02-12  1:34     ` agent
2014-02-12  2:03       ` adambeneschan
2014-02-12 12:50         ` agent
2014-02-12  1:30   ` Jeffrey Carter
2014-02-12  1:50     ` adambeneschan
2014-02-12 15:53   ` Robert A Duff
2014-02-12 17:55     ` J-P. Rosen
2014-02-14 12:39       ` agent
2014-02-14 18:36         ` AdaControl was: " Simon Clubley
2014-02-15  6:26         ` J-P. Rosen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox