comp.lang.ada
 help / color / mirror / Atom feed
* integer types and reference manual
@ 2004-07-20 13:41 Evangelista Sami
  2004-07-20 14:44 ` Stephen Leake
  2004-07-20 18:53 ` Jeffrey Carter
  0 siblings, 2 replies; 3+ messages in thread
From: Evangelista Sami @ 2004-07-20 13:41 UTC (permalink / raw)


hello all

just two questions about this sample code :

01   procedure Test is
02     type U is range 1..100;
03     N : constant U := 100;
04     type T is mod N + 10;
05   begin
06      null;
07   end;


1) what is the type of N + 10 ?
2) in the syntax summary of the RM there is the token
"static_expression". what is it exactly? an expression which value can
be computed at the compilation time?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: integer types and reference manual
  2004-07-20 13:41 integer types and reference manual Evangelista Sami
@ 2004-07-20 14:44 ` Stephen Leake
  2004-07-20 18:53 ` Jeffrey Carter
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Leake @ 2004-07-20 14:44 UTC (permalink / raw)
  To: comp.lang.ada

evangeli@cnam.fr (Evangelista Sami) writes:

> hello all
> 
> just two questions about this sample code :
> 
> 01   procedure Test is
> 02     type U is range 1..100;
> 03     N : constant U := 100;
> 04     type T is mod N + 10;
> 05   begin
> 06      null;
> 07   end;
> 
> 
> 1) what is the type of N + 10 ?

ARM 3.5.4 (5) says it's of "any integer type". Loosely speaking, you
can think of it as "universal integer".

> 2) in the syntax summary of the RM there is the token
> "static_expression". what is it exactly? 

To answer that precisely, you need to study the Annotated Ada
Reference manual in detail. Available at
http://www.adaic.com/standards/ada95.html, and in Emacs Info format at
http://www.adaic.com/standards/ada95.html

> an expression which value can be computed at the compilation time?

That's close enough for most purposes. The compiler will give you an
error when you hit a corner case where it's not "close enough".

-- 
-- Stephe




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: integer types and reference manual
  2004-07-20 13:41 integer types and reference manual Evangelista Sami
  2004-07-20 14:44 ` Stephen Leake
@ 2004-07-20 18:53 ` Jeffrey Carter
  1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey Carter @ 2004-07-20 18:53 UTC (permalink / raw)


Evangelista Sami wrote:

> 01   procedure Test is
> 02     type U is range 1..100;
> 03     N : constant U := 100;
> 04     type T is mod N + 10;
> 05   begin
> 06      null;
> 07   end;
> 
> 1) what is the type of N + 10 ?

U'Base.

-- 
Jeff Carter
"Oh Lord, bless this thy hand grenade, that with it thou
mayst blow thine enemies to tiny bits, in thy mercy."
Monty Python and the Holy Grail
24




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-20 18:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-20 13:41 integer types and reference manual Evangelista Sami
2004-07-20 14:44 ` Stephen Leake
2004-07-20 18:53 ` Jeffrey Carter

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