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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,90f687f65a66617e X-Google-Attributes: gid103376,public From: "Bob Klungle" Subject: Re: Simple ADA/C Question Date: 1997/02/26 Message-ID: <01bc23b2$ecc64960$64e2b8cd@p5120.bda>#1/1 X-Deja-AN: 221503065 References: Organization: B & D Associates X-NETCOM-Date: Tue Feb 25 10:58:59 PM PST 1997 Newsgroups: comp.lang.ada Date: 1997-02-25T22:58:59-08:00 List-Id: Without the code any comment is a guess. However it sounds as though the data type being interfaced to the C function is "type mytype is integer;" or something like that. If the C function returns int, The Ada should give you an exception and crash the program (unless you are capturing the exception with something like: exception when others => Null; end;) Either the C code has to check for invalid input or an exception handler within the enclosing Ada function must handle type mismatches (it goes without saying a real is not an int). cheers...bob root wrote in article ... > Hello, > > I am very new to ADA ( 3-4 days experience ) and I have a question that > probably has a simple answer. As part of my learning experience, I wrote > a simple piece of code that requests the user to enter an integer and then > the integer is displayed. My ADA code calls a C function, which requests > and then returns the integer. The primary ADA task consists of a loop so > the I can go get as many integers as I want as long as I input 'y' when > prompted ( the default is no ). This works fine as long as I enter an > integer. If I enter a real, the program exits as if I had hit the default. > What am I forgetting to check to prevent a real, or any unexpected value, > from having this effect? TIA. > > AE > > >