On 30/09/2007, David J. Fiander <[EMAIL PROTECTED]> 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

Reply via email to