comp.lang.ada
 help / color / mirror / Atom feed
From: Duke Normandin <dukeofperl@ml1.net>
Subject: Re: Noob question: universal_integer type
Date: Sat, 22 May 2010 02:04:00 GMT
Date: 2010-05-22T02:04:00+00:00	[thread overview]
Message-ID: <kYGJn.4434$Z6.3742@edtnps82> (raw)
In-Reply-To: ht75h2$d37$1@tornado.tornevall.net

On 2010-05-21, Jeffrey R. Carter <spam.jrcarter.not@spam.acm.org> wrote:
> Duke Normandin wrote:
>> 
>> Let me get this right... if I use an undeclared integer in an expression,
>> Ada will "deem it" to be a "universal_integer" and not choke at
>> compile-time?
>
> I don't know, and I've been using Ada since 1984. What is "an undeclared integer"?
>
> 17 is an integer literal; all integer literals are universal_integer. 17 is not 
> an undeclared integer.
>
> What the tutorial is trying to get across is that Ada, unlike some languages, 
> does not have typed numeric literals (see also universal_real). You might 
> encounter a language in which 10 is a literal of type int and 10L a literal of 
> long int, for example. In Ada, all integer literals are universal_integer, and 
> implicitly converted to specific integer types as required.
>
> Partly this makes life easier: you can change the type of a variable and not 
> have to change all the literals used with that variable; and partly it's pretty 
> much needed in a language that lets you define your own numeric types.
>

OK! I got it...
-- 
Duke
*** Tolerance becomes a crime, when applied to evil [Thomas Mann] *** 




  reply	other threads:[~2010-05-22  2:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-21 23:15 Noob question: universal_integer type Duke Normandin
2010-05-21 23:33 ` Yannick Duchêne (Hibou57)
2010-05-21 23:34   ` Yannick Duchêne (Hibou57)
2010-05-21 23:37 ` Jeffrey R. Carter
2010-05-22  2:04   ` Duke Normandin [this message]
2010-05-22  7:16   ` Niklas Holsti
2010-05-22 13:04     ` Duke Normandin
2010-05-22 13:47       ` Dmitry A. Kazakov
2010-05-22 14:51         ` Duke Normandin
2010-05-22 20:08       ` Yannick Duchêne (Hibou57)
2010-05-23  2:28         ` Duke Normandin
2010-05-23  2:36           ` Yannick Duchêne (Hibou57)
replies disabled

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