[OPEN-ILS-DEV] Re: PATCH: bzero is deprecated and unnecessary

Dan Scott denials at gmail.com
Sun Sep 30 11:12:29 EDT 2007


On 30/09/2007, David J. Fiander <djfiander at fastmail.fm> wrote:
> >
> > First, I wouldn't initialize the buffer with nuls.  I'd initialize it
> > with (for example) exclamation points, with perhaps a nul at the end.
> > That way if a wayward pointer gives us a string of exclamation points,
> > we'll have a better chance of recognizing the problem.  A string of
> > nuls is neither distinctive nor informative.
> >
>
> I agree.  A long time ago I used to use a debugging malloc library
> that filled the buffers returned with '\001' bytes.  It's amazing how
> many bugs one finds that way.
>

Also agreed here - debug builds of a commercial product I worked on
used the same approach, and it did turn up lots of uglies in unit
tests that had been hidden by nul initialization.

-- 
Dan Scott
Laurentian University


More information about the Open-ils-dev mailing list