exit();

Jim Balter jim at segue.segue.com
Mon Apr 1 08:03:27 AEST 1991


In article <1991Mar30.155011.767 at rodan.acs.syr.edu> jkchan at lynx.cat.syr.edu (J. K. Chan) writes:
>    exit value declared inconsistently	llib-lc(232)  ::  t.c(8)

How is exit declared in stdlib.h and in llib-lc on your system?  They should
both be declared as returning void.  I suspect that your stdlib.h doesn't
declare exit at all, which would explain why the message refers to t.c(8),
which would be an implicit declaration of  int exit();  in the absense of
a declaration in stdlib.h.

When posting a question like this to the net, you really ought to provide the
obvious information (what system and compiler you are using, what line 232 of
llib-lc is) rather than assuming people have E.S.P. or that all systems are
identical.

It is also useful to treat such a specific informative message from lint as
just that, rather than as a magic incantation.

In any case, your usage of exit is fine.  Some compilers and versions of lint
will also complain that main returns no value even though it is expected to.
Some will honor a comment on the declaration of exit indicating that it never
returns, or (inferior) some will honor a /*NOTREACHED*/ following the call
to exit, but since this is far from universal, just learn to ignore the
warnings when issued in conjunction with exit.  Or use return instead of exit
in main; thats will avoid the warnings in this case.



More information about the Comp.unix.programmer mailing list