This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFA] Ensure result of make_cleanup is never NULL.


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


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