Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!usenix!std-unix From: decot@hpisod2.cup.hp.com (Dave Decot) Newsgroups: comp.std.unix Subject: Re: Question about atexit() Message-ID: <444@usenix.ORG> Date: 21 Aug 90 04:04:16 GMT References: <442@usenix.ORG> Sender: std-unix@usenix.ORG Organization: Hewlett Packard, Cupertino Lines: 41 Approved: jsq@usenix.org (Moderator, John Quarterman) X-Submissions: std-unix@uunet.uu.net From: decot@hpisod2.cup.hp.com (Dave Decot) > Recently, while discussing pthreads, I mentioned the use of atexit() > as a way of helping thread cleanup if another thread calls exit(). > It was pointed out to me that atexit() is not defined in 1003.1 > 1988. > I originally assumed that as .1 #includes all of ANSI C then atexit() > would be able to be used in a conforming application but the book > appears to indicate otherwise. That assumption is false: only for one type of conformance is all of ANSI C required. For other types, only interfaces reflecting "common usage in C" are required (a mostly undefined concept, unfortunately). > So, can anyone in .1 explain whether atexit() really is required > by .1 or not and if not, what the rationale is because I don't > understand what the book is getting at. > ... > Simon Patience atexit() is required when the implementation claims Standard C Language support, since it is required by the C Standard. atexit() is not required for implementations that claim Common Usage C Language Support, although the fact must be documented that exit() does not work as defined by the C standard. For the reasons stated by Simon above, I personally think it should have been included in the list of functions at the beginning of Chapter 8 of POSIX.1-1988, but wasn't. I would like to see it (or some kind of language independent version, at least, with it required in the C binding) required by a future version of POSIX.1 . In the mean time, I think it would be prudent for POSIX.4 and POSIX.4a to require a C Standard conforming atexit() function. Dave Decot Volume-Number: Volume 21, Number 46