This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: RFA: reducing size of _atexit structure for _REENT_SMALL
- From: Nick Clifton <nickc at redhat dot com>
- To: Jeff Johnston <jjohnstn at redhat dot com>
- Cc: newlib at sources dot redhat dot com
- Date: Sat, 11 Mar 2006 09:23:40 +0000
- Subject: Re: RFA: reducing size of _atexit structure for _REENT_SMALL
- References: <m37j727eml.fsf@redhat.com> <4411E35A.1090907@redhat.com>
Hi Jeff,
The reason that the implementation is such is because ANSI C90
actually states for atexit(): "The implementation shall support the
registration of at least 32 functions". This isn't true if you only
support dynamically allocated storage.
Now that said, there is the question of how much a _REENT_SMALL
processor wishes to adhere to ANSI C. At the very least, I think this
should be governed by YAF (yet another flag). Comments?
You are right, although I was trying to avoid defining yet another flag.
I think that in this case ANSI conformance would only be compromised
if there was insufficient room to allocate memory for the 32 element
function pointer array when the first atexit function called. If this
were to happen then the application would have to be operating at the
very limits of its available memory, and it could only have gotten to
this situation because _REENT_SMALL had reduced the size of the _reent
structure sufficiently to allow it to run in the first place. Thus I
think that this (theoretical) application could never run in an ANSI
conformant way because it just needs too much memory.
I like to keep things simple, so to my mind it is simpler and cleaner to
just use the _REENT_SMALL definition to make this change the _reent
structure, rather than introducing yet another flag. I realise that it
does break strict ANSI conformance, but I think that this is OK. We
could include a warning comment in reent.h (or config.h) to let people
who define _REENT_SMALL know the risks.
Cheers
Nick