From: Luca Cappelletti <luca.cappelletti@gmail.com>
Subject: Simple loop with a strange output
Date: Thu, 23 May 2013 06:53:19 -0700 (PDT)
Date: 2013-05-23T06:53:19-07:00 [thread overview]
Message-ID: <7cd707ce-ebc5-4df1-9ec3-4f99ce87a07d@googlegroups.com> (raw)
Hello,
I'm using GNAT 4.6 via Debian 7
I've just compiled this simple code coming from a tutorial where I've just a little bit changed to fit my test:
with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
procedure Hello is
procedure Raddoppia(Elemento: in out Integer) is
begin
Elemento := Elemento * 2;
end Raddoppia;
X : Integer;
begin
Put_Line("start counting");
New_Line;
X := 1;
while X < 1009999999 loop
Put(X);
New_Line;
Raddoppia(X);
end loop;
end Hello;
that produce the expected:
$./hello
Ciao a tutti sto usando Put_Line direttamente con la clausola use
1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
16777216
33554432
67108864
134217728
268435456
536870912
now that strange error:
if you change the code using only the simple "loop - end loop" or change the number into the while from 1009999999 to 1099999999
my output will be an infinite sequence of zero
$./hello
0
0
0
0
...
0
...
do you know what's happening?
thank in advance,
Luca
next reply other threads:[~2013-05-23 13:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-23 13:53 Luca Cappelletti [this message]
2013-05-23 13:55 ` Simple loop with a strange output Luca Cappelletti
2013-05-23 14:37 ` Adam Beneschan
2013-05-23 14:41 ` Adam Beneschan
2013-05-23 16:09 ` Luca Cappelletti
2013-05-23 16:40 ` Simon Wright
2013-05-23 21:34 ` Randy Brukardt
2013-05-24 7:21 ` Simon Wright
2013-05-24 12:46 ` Britt
2013-05-23 20:41 ` Dirk Heinrichs
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox