Fast code and no morals (exit() on VMS)
Robert Perlberg
perl at rdin.UUCP
Fri Feb 21 06:12:12 AEST 1986
>I know this is naive, but then this flock is full of naive users...
>Doug, where exactly do Kernighan & Ritchie specify the semantics of
>the exit() procedure ?
>
> you can't say VMS is WRONG
>just because it's DIFFERENT unless you can quote chapter and verse.
>
>Does the ANSI draft specify semantics for system calls ?
K&R, Chapter 7, page 154, verse 5 (and I quote -- uh-hum):
"The program also uses the standard library function exit, which
terminates program execution when it is called. The argument of exit
is available to whatever process called this one, so the success or
failure of the program can be tested by another program that uses this
one as a subprocess. By convention, a return value of 0 signals that
all is well, and various non-zero values signal abnormal situations."
Amen.
Let's get real, though. I don't really care about how something is
defined by K&R or ANSI or any so-called authority. All I care about is
being able to copy a bunch of code onto a system, compile it, and have
it work. If the designers of VAX C endowed it with an exit() function,
it's not because they saw it in K&R, it's because they wanted VAX C to
be able to compile and run the vast body of C code "out there". The
VAX C manual is loaded with references to UNIX and has many functions
which are clearly intended to mimic UNIX (take a look at stat()). You
could quote K&R till doomsday and it wouldn't make existing code run on
existing systems until you wake up and take a look at how things are
done in the real world and adapt to it. You're a fine one to be
calling others "naive".
Robert Perlberg
Resource Dynamics Inc.
New York
{philabs|delftcc}!rdin!perl
More information about the Comp.lang.c
mailing list