This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: atexit bug?


A patch has been checked in. Thanks.

-- Jeff J.

Nick Clifton wrote:
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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]