This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to initialize pretty_printer's line_length
Per Bothner <per@bothner.com> writes:
> Jason Merrill wrote:
>
> > Instead, please change the xmalloc for the buffer to use xcalloc so that
> > this won't break the next time someone adds a field.
>
> I remember arguing with H.J.Lu that this was just papering over
> problems. (It will break on systems where NULLs aren't all
> zero bits, for example - not that we support such systems.)
> Worse, explicit initialization forces people to think about
> the correct initial value.
>
> How about an alternative idea, where if ENABLE_CHECKING is on
> then we re-define xmalloc so it that memsets the returned
> block with 0xD1 or something like that?
That's a good idea; we should do that anyway.
--
- Geoffrey Keating <geoffk@geoffk.org>