This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [commit] Fix "show prompt"
On Sun, May 29, 2005 at 09:13:06AM +0300, Eli Zaretskii wrote:
> > switch (c->var_type)
> > {
> > case var_string:
> > - if (((char *)c->var)[0] != '\0')
> > - fputstr_filtered ((char *)c->var, '"', stb->stream);
> > + if (*(char **) c->var)
>
> Doesn't this work without a cast, like this:
>
> if (*c->var != NULL)
>
> ? I think we should avoid unneeded type-casting.
No:
/* Pointer to variable affected by "set" and "show". Doesn't matter
if type is not_set. */
void *var;
Can't dereference that. Really, this ought to be replaced with a
union, so that we could eliminate all the casts.
--
Daniel Jacobowitz
CodeSourcery, LLC