I am studying the Advanced programming in the unix environment.
There they says that we can register upto 32 functions with atexit().
Why that is limited to 32 functions?
It is not limited to 32 functions. It must allow _at least_ 32
functions. An implementation that supported 1,000,000 functions would
be conforming.
From "ISO/IEC 9899:1999 (E)":
7.20.4.2 The atexit function
Synopsis
1 #include <stdlib.h>
int atexit(void (*func)(void));
Description
2 The atexit function registers the function pointed to by func, to be
called without arguments at normal program termination.
Environmental limits
3 The implementation shall support the registration of at least 32
functions.
Returns
4 The atexit function returns zero if the registration succeeds,
nonzero if it fails.
Forward references: the exit function (7.20.4.3).