This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: atexit bug?
- From: Nick Clifton <nickc at redhat dot com>
- To: Ben Elliston <bje at wasabisystems dot com>
- Cc: newlib at sources dot redhat dot com
- Date: Fri, 05 Sep 2003 07:27:19 +0100
- Subject: Re: atexit bug?
- References: <20030905031544.GG4624@mononoke.wasabisystems.com>
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