atexit bug?

Nick Clifton nickc@redhat.com
Wed Sep 10 15:58:00 GMT 2003


Hi Ben,

> In libc/stdlib/exit.c (_DEFUN), I see:
>
>   register struct _atexit *p;
>   register struct _on_exit_args * args;
>   register int n;
>   int i;
>
>   p = &_GLOBAL_REENT->_atexit;
>
> I think this might have problems.  When REENT_SMALL is defined,
> _reent::_atexit (using C++ scoping notation) is a struct _atexit
> member, whereas when it is not defined, it is a pointer to a struct
> _atexit meaning that _GLOBAL_REENT->_atexit's type changes depending
> on the state of REENT_SMALL.
>
> Is my understanding correct?

I believe so.  Presumably if we had code like this:

  #ifdef _REENT_SMALL
    p = &_GLOBAL_REENT->_atexit;
  #else
    p = _GLOBAL_REENT->_atexit;
  #endif

Then the types would be correct ?

Cheers
        Nick
        



More information about the Newlib mailing list