comp.lang.ada
 help / color / mirror / Atom feed
From: do_while@ridgecrest.ca.us (Do-While Jones)
Subject: Re: Program (not task) Activation
Date: 1998/04/27
Date: 1998-04-27T00:00:00+00:00	[thread overview]
Message-ID: <6i2egl$o5$1@owens.ridgecrest.ca.us> (raw)
In-Reply-To: Eru8pD.4E@jvdsys.nextjk.stuyts.nl


Jerry van Dijk posted a useful demo program, which Michael Brenner
expanded to include tests to make sure the expected error code were
returned.

Michael's claimed results can't really be the results from the program he
included in his message because there are five results, but only four test
cases.  He clearly (and very kindly) deleted the "rabbits"  test (which
would have recursively called itself until the stack crashed).  He also
changed exitcode 1 to exitcode 7.  But these are minor changes.  He
probably edited his test program and forgot to revise the results.  (Maybe
he inserted an old copy of the program file in his message.)  Anyway, it
isn't important.

What is important is that when he ran his test on NT 4.0, he got
non-zero results when he should have.  When I ran his program on Windows
95, I got zero every time.  (I couldn't run his "exitcode" program because
that must have been a C program he wrote but failed to include in
the message.)

So, my original question ("Does anyone know why Windows 95 did not return
an error code?") still stands.

Jerry asked, "Also, since you are using Ada 95, why the difficult code?"

The short answer is that this was legacy Ada 83 code written for UNIX.  I
just compiled it on Windows 95 and was surprised that it worked at all.

The long answer is that I wanted to make the system call safer and more
Ada-like.

In C, procedures are written as functions.  I hate that.  I wrote
SHELL.Command as a procedure that RAISES AN EXCEPTION if it fails.  This
relieves application programs of having to check the result to see if it
is zero or not.  If I knew the values of E2BIG, ENOENT, etc., I would
make my SHELL package even more difficult by adding another function that
converts the error value to a string ("Argument list too big.", "Command
interpreter not found", etc.)  

I don't like to have to remember to check a function result to see if a
procedure failed or not.  I made the SHELL.Command procedure difficult so
that programs that call SHELL.Command could be simple. 

Do-While Jones

            +--------------------------------+
            |    Know                 Ada    |
            |        [Ada's Portrait]        |
            |    Will              Travel    |
            | wire do_while@ridgecrest.ca.us |
            +--------------------------------+





  parent reply	other threads:[~1998-04-27  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-17  0:00 Program (not task) Activation Jeremy T Smith
1998-04-21  0:00 ` Robert I. Eachus
1998-04-21  0:00   ` Do-While Jones
1998-04-22  0:00     ` Jerry van Dijk
1998-04-24  0:00       ` Michael F Brenner
1998-04-27  0:00       ` Do-While Jones [this message]
1998-04-28  0:00         ` Jerry van Dijk
1998-04-29  0:00           ` Do-While Jones
1998-04-29  0:00             ` Do-While Jones
replies disabled

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