5 /* atexit( void (*)( void ) )
7 This file is part of the Public Domain C Library (PDCLib).
8 Permission is granted to use, modify, and / or redistribute at will.
15 extern void (*_PDCLIB_regstack[])( void );
16 extern size_t _PDCLIB_regptr;
18 int atexit( void (*func)( void ) )
20 if ( _PDCLIB_regptr == 0 )
26 _PDCLIB_regstack[ --_PDCLIB_regptr ] = func;
34 #include <_PDCLIB_test.h>
37 static int flags[ 32 ];
39 static void counthandler()
46 static void checkhandler()
48 for ( int i = 0; i < 31; ++i )
50 assert( flags[ i ] == i );
57 TESTCASE( atexit( &checkhandler ) == 0 );
58 for ( int i = 0; i < 31; ++i )
60 TESTCASE( atexit( &counthandler ) == 0 );