Strange lint mumblings
T. William Wells
bill at twwells.uucp
Thu Dec 29 16:21:47 AEST 1988
In article <1700 at valhalla.ee.rochester.edu> badri at valhalla.ee.rochester.edu (Badri Lokanathan) writes:
: Alas, some of us (at least I) have gotten used to the easy clean up facility
: that exit() provides. That is, flushing all I/O buffers and closing
: them. return(status) works cleanly if the programmer takes care of
: this. I have personally not had this problem with return/exit in lint, so I
: shall continue to use exit (maybe I should use egress as PT Barnum once
: did :-)
Returning from main does all these things on every system I know of.
In other words,
main()
{
...
return (0);
}
and
main()
{
...
exit(0);
}
are pretty much equivalent. Generally, main is called from another
routine which, besides setting up the C run-time environment, does
something like:
crt0(argc, argv)
{
exit(main(argc, argv));
}
The only exception that I know of to this are systems, like certain
versions of SunOS, that behave more like:
crt0(argc, argv)
{
main(argc, argv);
exit(0);
}
---
Bill
{uunet|novavax}!proxftl!twwells!bill
More information about the Comp.lang.c
mailing list