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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cf3a056f36b4078f X-Google-Attributes: gid103376,public From: kst@thomsoft.com (Keith Thompson) Subject: Re: Ada vs C++ for numeric IO (integers) Date: 1996/07/24 Message-ID: #1/1 X-Deja-AN: 170446582 sender: news@thomsoft.com (USENET News Admin @flash) x-nntp-posting-host: pulsar references: organization: Thomson Software Products, San Diego, CA, USA newsgroups: comp.lang.ada originator: kst@pulsar Date: 1996-07-24T00:00:00+00:00 List-Id: In nasser@apldbio.com (Nasser Abbasi) writes: > I noticed that constraint error is not raised for short_integer if > I input a value outside short_integer range in an IO operation for > example. I check the LRM, and it does say that in 3.5.4.20 . RM95-3.5.4(20) is the paragraph that says that operations that can't deliver a correct answer due to overflow raise Constraint_Error. I/O operations are not considered "operations" in the sense intended in that paragraph. The relevant paragraph is A.10.8(10), which says that Get raises Data_Error if the value obtained is not within the bounds of the subtype. You didn't say so, but I presume you're using GNAT. One of GNAT's more obscure features is that overflow, stack, and elaboration checks are disabled by default (because their current implementation of these checks is inefficient). You can enable them by using the "-gnato" option to gcc or gnatmake. With these checks enabled, Get correctly raises Data_Error. Incidentally, if you use Ada.Short_Integer_Text_IO (a pre-instantiation of Ada.Integer_IO), you'll get this problem regardless of how you compile your own program. Apparently Short_Integer_Text_IO was compiled without the -gnato option. I've reported this to report@gnat.com. -- Keith Thompson (The_Other_Keith) kst@thomsoft.com <*> TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products 10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718 "As the most participatory form of mass speech yet developed, the Internet deserves the highest protection from government intrusion." -- ACLU v. Reno