This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Ensure result of make_cleanup is never NULL.
- From: Pedro Alves <palves at redhat dot com>
- To: Doug Evans <dje at sebabeach dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 16 Apr 2012 11:52:22 +0100
- Subject: Re: [RFA] Ensure result of make_cleanup is never NULL.
- References: <m3bomszayu.fsf@annie.sebabeach.org>
This looks good to me.
On 04/16/2012 03:06 AM, Doug Evans wrote:
> +/* A fencepost used to mark the end of a cleanup chain.
> + The value is chosen to be non-NULL so that make_cleanup never returns NULL,
> + and cause a segv if dereferenced. */
> +#define CLEANUP_FENCEPOST ((struct cleanup *) 1)
I'd mildly prefer -1. Easier to spot as being special with the
debugger; as a general principle for these things, it's an address less likely
to end be created by mistake (thinking of &foo->a yieling a pointer to a
low address when foo is NULL); and it is just more customary.
--
Pedro Alves