This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: naive GDB programming style questions
On Mon, 09 Sep 2002 21:45:54 -0400, Andrew Cagney <ac131313@ges.redhat.com> said:
> I'll assume that you ment ``p_is_null()''.
Right.
> If you've a copy of the ISO C and C++ manuals, have a look at what
> they have to say about ``NULL'' pointers. It's weird.
Really? Hmm. I know that NULL doesn't work as well in C++ as it does
in C, so I've gotten used to using 0 there.
Though if you're referring to the fact that NULL's underlying bit
representation might not be 0, I'm not sure that's a big deal here.
> Anyway, for GDB, ``p == NULL'' is recommended to make it clear that
> the pointer is being tested and not the underlying value.
Okay, then that's what I'll do.
> Just use:
> struct foo
> {
> int mem;
> };
> which is what is output by gdb_indent.sh and emacs.
Excellent.
David