From: "Bennett, Chip (KTR) ~U" <BennettC@J64.STRATCOM.AF.MIL>
Subject: Re: Using procedures
Date: Mon, 5 Dec 1994 13:42:00 PST
Date: 1994-12-05T13:42:00-08:00 [thread overview]
Message-ID: <2EE38942@SMTPGATE2.STRATCOM.AF.MIL> (raw)
Bill Heiser <bill@BHHOME.BH.ORG> wrote:
> I am down to the wire and have to complete a couple of Ada programs ASAP.
> There is something I just don't get about using procedures in Ada.
> If I have a program with multiple procedures, how do I get all of
> them to run? If I try to call one from another, the compiler
> complains of undeclared identifiers.
> i.e.
>
> with text_io;
> procedure putv(i: OUT integer) is
> begin
> for i in 1..5 loop
> text_io.put(integer'image(i));
> end loop;
>
> end putv;
>
> with text_io;
> procedure puty(j: OUT integer) is
> begin
> for j in 1..5 loop
> text_io.put(integer'image(j));
> end loop;
> end puty;
>
> How (for example) do I call putv from puty? If I try a "putv(something)",
> the compiler complains that putv is an undeclared identifier. If I run
> this little program as-is, it runs, but only one of the functions runs
> (I get a "1-5", not two sets of them as I'd expect).
>
> I'm really down to the wire to get these programs done for school, so
> any help would be much appreciated.
>
> BTW, this is for Ada/6000 release 3.3 on an RS/6000 running AIX 3.2.5.
>
> Thanks,
> Bill
> --
> Bill Heiser: bill@bh.org http://www.bh.org/
> PGP public key available upon request.
>
Bill, your question shows you either haven't read the book, or you're not
listening in class, so I'll be brief and leave "the proof as an exercise"
:-). Nest the subroutine or put it in a package. (If I've misjudged the
situation I apologize.)
But this brings up a bigger point that is the real reason I bother to post
this. I want to promote Ada, but I question whether doing a students
homework is going too far. Comments?
*****************************************************************
* Chip Bennett, GDE Systems Inc | BennettC@j64.stratcom.af.mil *
* USSTRATCOM/J64213 | Voice (402)294-7360 *
* 901 SAC Blvd, Suite 2B24 | FAX (402)294-7912 *
* Offutt AFB, NE 68113-6600 | Proud member of Team Ada *
* Opinions expressed here are my own _so_, TTFWTW *
*****************************************************************
next reply other threads:[~1994-12-05 21:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-12-05 21:42 Bennett, Chip (KTR) ~U [this message]
1994-12-06 18:59 ` Using procedures Bill Heiser
1994-12-08 12:40 ` Gentle
1994-12-07 20:46 ` -mlc-+Schilling J.
1994-12-07 23:35 ` Robert Dewar
-- strict thread matches above, loose matches on Subject: below --
1994-12-06 17:20 Bob Wells #402
1994-12-06 19:02 ` Bill Heiser
1994-12-03 20:32 Bill Heiser
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox