Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [commit] Fix "show prompt"
Date: Sun, 29 May 2005 15:07:00 -0000	[thread overview]
Message-ID: <20050529142320.GD23858@nevyn.them.org> (raw)
In-Reply-To: <u3bs6a7bh.fsf@gnu.org>

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


      reply	other threads:[~2005-05-29 14:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-28 18:40 Daniel Jacobowitz
2005-05-29  7:41 ` Eli Zaretskii
2005-05-29 15:07   ` Daniel Jacobowitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050529142320.GD23858@nevyn.them.org \
    --to=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox