comp.lang.ada
 help / color / mirror / Atom feed
From: "Bob Klungle" <bklungle@ix.netcom.com>
Subject: Re: Simple ADA/C Question
Date: 1997/02/26
Date: 1997-02-25T22:58:59-08:00	[thread overview]
Message-ID: <01bc23b2$ecc64960$64e2b8cd@p5120.bda> (raw)
In-Reply-To: Pine.LNX.3.95.970225100418.10492A-100000@vf700f.msfc.nasa.gov


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 <root@vf700f.msfc.nasa.gov> wrote in article
<Pine.LNX.3.95.970225100418.10492A-100000@vf700f.msfc.nasa.gov>...
> 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
> 
> 
> 




  reply	other threads:[~1997-02-26  0:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-25  0:00 Simple ADA/C Question root
1997-02-26  0:00 ` Bob Klungle [this message]
1997-02-26  0:00   ` root
1997-02-26  0:00     ` Robert Dewar
1997-02-28  0:00       ` Keith Thompson
1997-03-02  0:00         ` Robert Dewar
1997-03-04  0:00           ` Keith Thompson
1997-03-04  0:00             ` Robert Dewar
1997-03-04  0:00               ` John McCabe
1997-03-04  0:00                 ` Anders Eliasson
1997-03-04  0:00                 ` Robert Dewar
1997-03-06  0:00                   ` Keith Thompson
1997-03-06  0:00                     ` Robert Dewar
1997-03-06  0:00                     ` Larry Kilgallen
1997-03-09  0:00                       ` Robert Dewar
1997-02-26  0:00     ` Stephen Leake
1997-02-26  0:00       ` root
1997-02-26  0:00     ` John McCabe
1997-02-27  0:00 ` Robert Dewar
1997-02-27  0:00   ` root
1997-02-27  0:00   ` root
1997-03-03  0:00 ` Robert I. Eachus
1997-03-05  0:00   ` Robert Dewar
1997-03-05  0:00 ` Jon S Anthony
1997-03-06  0:00   ` Robert Dewar
1997-03-07  0:00 ` Jon S Anthony
1997-03-07  0:00   ` Robert Dewar
1997-03-08  0:00     ` Larry Kilgallen
1997-03-07  0:00   ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox