Checking Exit Codes

John F. Haugh II jfh at rpp386.cactus.org
Wed Nov 7 18:18:54 AEST 1990


In article <4460 at segue.segue.com> jim at segue.segue.com (Jim Balter) writes:
>In article <18689 at rpp386.cactus.org> jfh at rpp386.cactus.org (John F. Haugh II) writes:
>>as i said, it was a fake example.  you pay your money, you take your chances.
>
>I hope no one is paying you money for your advice.

well, there appears to be some confusion.  it is not my "opinion" or
my "advice" that assert() may return, but rather a statement of
reality.  like it or not, on certain machines

	signal (SIGIOT, SIG_IGN);
	assert (0 == 1);
	puts ("this will never print out");

WILL print out.  i don't have to agree with it or disagree with it
or like it or not - it is simply a statement of fact.

furthermore, the statement that assert() prints an error and then
calls abort() is likewise false.  if your application (for example,
debugging) =expects= that assert(FALSE) generate a core dump due to
abort() being called, you are making an assumption that does not
take into account every perverse implementation of assert() ever
made - including a very popular unix-derivative from microsoft
called "xenix".  again, i neither have to agree or disagree that
this is a good idea - i am simply reporting a fact.

>                                                 And whether abort dumps core
>or not is an issue outside the ANSI C standard and is hardly a portability
>issue.  Once you get an assert failure; it is time to debug; you can force all
>the core dumps you want.

there are more compilers in this world that ANSI C compilers.  if
you want to pretend ANSI C is the only C language out there, then
of course "assert" always gives the expected result.  i mean, in
a perfect world everything is perfect.  i have to use at least
3 different C compilers every day.  i don't have the luxury of
assuming every C compiler is ANSI compliant.
-- 
John F. Haugh II                             UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 832-8832                           Domain: jfh at rpp386.cactus.org
"SCCS, the source motel!  Programs check in and never check out!"
		-- Ken Thompson



More information about the Comp.unix.internals mailing list