From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, STOX_REPLY_TYPE autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2317a992e7241939 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "David C. Hoos, Sr." Newsgroups: comp.lang.ada Subject: Re: GNAT won't link on "warning" Date: Mon, 29 Nov 2004 06:37:38 -0600 Organization: Cuivre, Argent, Or Message-ID: References: <3664370.5jO7nDmgDP@linux1.krischik.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1101731910 13381 212.85.156.195 (29 Nov 2004 12:38:30 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 29 Nov 2004 12:38:30 +0000 (UTC) Cc: comp.lang.ada@ada-france.org To: Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:6632 Date: 2004-11-29T06:37:38-06:00 The reason it won't compile is that you caused the constraint error at compile time. This is an error and not a warning. When runtime constraint errors are detected at compile time, the warning message says "will raise constraint_error." The message you received said "raises constraint_error," i.e. present tense, instead of the future tense warning. If you do the illegal conversion at run time (i.e. after the "begin," it will compile and link, with a warning, but fail at run time. ----- Original Message ----- From: "Martin Krischik" Newsgroups: comp.lang.ada To: Sent: November 29, 2004 3:45 AM Subject: GNAT won't link on "warning" > Hello, > > For demonstation purpose I wanted to write a program which will raise an > exception on converting some data: > > with Ada.Text_IO; > > procedure Convert_Checked > is > type Short_Short_Integer is range -(2**7) .. +(2**7-1); > type Byte is mod 2**8; > > package T_IO renames Ada.Text_IO; > package M_IO is new Ada.Text_IO.Modular_IO (Byte); > > A : constant Short_Short_Integer := -1; > B : constant Byte := Byte (A); > begin > T_IO.Put ("B = "); > M_IO.Put ( > Item => B, > Width => 5, > Base => 10); > end Convert_Checked; > > When I compile the demo I get: > > convert_checked.adb:12:40: value not in range of type "Byte" defined at line > 6 > convert_checked.adb:12:40: static expression raises "Constraint_Error" > > It is my intention to use a value which is not in range of type "Byte" and > "Constraint_Error" is precicly what I want to demonstate. > > However, GNAT won't link the program. Actually GNAT won't even create an *.o > file. Is this right? Is there an option to force creation? > > With Regards > > Martin > > -- > mailto://krischik@users.sourceforge.net > http://www.ada.krischik.com > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada-france.org > http://www.ada-france.org/mailman/listinfo/comp.lang.ada > >