Talk:Day of the week: Difference between revisions

m
→‎Ada hard time...: lang tag fixing also into talk pages...?
m (→‎Ada hard time...: lang tag fixing also into talk pages...?)
Line 67:
I did all the kind of tests I could do. At the end, taken a look at the *.ads file (ugly naming conventions!), and at the end I successfulling compiled the following code:
 
<lang ada>with GNAT.Calendar; use GNAT.Calendar;
with GNAT.Calendar.Time_IO; use GNAT.Calendar.Time_IO;
with Ada.Text_IO; use Ada.Text_IO;
Line 78:
end if;
end loop;
end Yuletide;</adalang>
 
Which by the way on my machine outputs (only last lines)
Line 91:
: I see, now it seems to be clear. First of all, GNAT.Calendar is not a part of the standard. But that is not the problem, Ada.Calendar is. The standard ([[Ada 2005]]) requires Year_Number to be at least in the range 1901..2399. See [http://www.adaic.org/standards/1zrm/html/RM-9-6.html LRM 9.6 11/2]. So the code given in the Ada solution '''must''' work, or else your compiler is not Ada 2005. From your attempts I deduce that it is indeed not. You have an [[Ada 95]] compiler. In Ada 95 the range of Number was narrower, 1901 .. 2099. This is why your code produces an exception. You can slightly modify your code:
<blockquote>
<lang ada>
with GNAT.Calendar; use GNAT.Calendar;
with GNAT.Calendar.Time_IO; use GNAT.Calendar.Time_IO;
Line 104:
end if;
end loop;
end Yuletide;</adalang>
</blockquote>
:Now the compiler will warn you that Year is not in the range of Year_Number and you will get Constraint_Error at run time. So the problem is that your GNAT is not [[Ada 2005]]. Remove it and install a new one. The official distributor is [https://libre.adacore.com here]. Register yourself (it is free) and download GNAT GPL for your platform. --[[User:Dmitry-kazakov|Dmitry-kazakov]] 21:48, 12 December 2008 (UTC)