This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] p-typeprint.c, move pointer use to after null-check.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: 'Michael Snyder' <msnyder at vmware dot com>, gdb-patches at sourceware dot org
- Date: Tue, 8 Mar 2011 18:56:17 +0400
- Subject: Re: [RFA] p-typeprint.c, move pointer use to after null-check.
- References: <4D6D58F2.8070207@vmware.com> <20110308051024.GL30306@adacore.com> <004e01cbdd9d$5d383600$17a8a200$@muller@ics-cnrs.unistra.fr>
> No, I think that the code relies on the fact that physname
> is never null, but that the constructor or destructor could have no
> parameters, in which case physname would point to \0
> after the '+= 6'.
OK, we agree, in fact:
> Is this correct:
> if (physname && (*physname != 0))
> or is:
> if (physname && *physname != 0)
>
> better?
> or should I use:
> if (physname && *physname != '\0')
My suggestion was to remove the "physname [!= NULL]" part only.
Hence:
if (*physname != '\0')
(I think we have more cases of '\0' than 0 when we're checking
character values)
--
Joel