This is the mail archive of the newlib@sourceware.org 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: [PATCH] Reduce code size of _REENT_INIT_PTR()


On 04/26/2013 02:43 AM, Sebastian Huber wrote:
> Use one memset() to initialize everything to zero.  Set non-zero fields
> in a second step.  There is only a small runtime overhead, but the code
> size is greatly reduced.  This change assumes the NULL pointer and '\0'
> are encoded as zero bits.

'\0' is required to be all zero bits by C99; no assumption required.
NULL is allowed to be encoded as non-zero bits, but such systems are
extremely rare, and I don't know of any newlib target that violates the
assumption (that is, we have other code in newlib that assumes a memset
to 0 correctly initializes null pointer values).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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