ANSI X3J11 onexit() implementation

Arthur David Olson ado at elsie.UUCP
Sun Jun 22 05:28:07 AEST 1986


In article <1438 at brl-smoke.ARPA>, gwyn at brl-smoke.ARPA (Doug Gwyn) writes:
> I have just posted a public-domain implementation of the ANSI X3J11
> (draft C language standard) "onexit" function. . .I am now in a position to
> criticize the interface. . .A much cleaner interface would be:
> 
> 	int onexit(void (*func)(void));
> 
> which would return zero or not depending on whether the function
> was successfully registered.  I think the current awkward design is
> an artifact of the original Whitesmiths, Ltd. implementation. . .

Having suggested the same myself (see mod.std.c archives), I'll second the
motion. . .with a qualification.  Since there are existing (Whitesmiths)
implementations with an interface different from that described above, it's
almost surely best to use a different name for the above interface--for
example,

 	int atexit(void (*func)(void));

This avoids surprises when moving existing source code to an ANSI standard
system.
--
	UUCP: ..decvax!seismo!elsie!ado		ARPA: elsie!ado at seismo.ARPA
	DEC, VAX, Elsie & Ado are Digital, Borden & Shakespeare trademarks.



More information about the Comp.lang.c mailing list