Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@gnu.org>
To: cagney@gnu.org
Cc: gdb-patches@sources.redhat.com
Subject: Re: [commit] Tighten memory read/write methods
Date: Thu, 27 Jan 2005 21:04:00 -0000	[thread overview]
Message-ID: <200501272103.j0RL3TWS001805@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <41F94AE7.4020405@gnu.org> (message from Andrew Cagney on Thu, 27 Jan 2005 15:11:19 -0500)

   Date: Thu, 27 Jan 2005 15:11:19 -0500
   From: Andrew Cagney <cagney@gnu.org>

   Hello,

   This cleans up the {target_,}{read,write}_memory methods making the 
   buffer parameter a bfd_byte (instead of "is it signed?" char)

Just curious, but is that really an issue in these buffer-like
contexts?  I thought signed-ness is only an issue if there is an
(implcit) conversion to an integer type involved.  If there are such
issues, bfd_byte seems like the appropriate type to use (but please
read on), but otherwise I'd prefer using standard ISO C types.

Anyway, isn't it better to sidestep the issue entirely, and use 'void
*' in these contexts?  That's what we have been doing in the past I
think.  Most 'char *' stuff is only there because too many people
still remember K&R C.

Anyway, I think we shouldn't change these things haphazardly.  Can we
formulate a set of programming guidelines such that we can try to be a
bit more consistent.  My set of rules would be:

* Use const wherever possible.
* Use 'void *' wherever possible.
* Use 'char *' in context where you need to add an offset to a pointer.

Mark


  reply	other threads:[~2005-01-27 21:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-27 20:11 Andrew Cagney
2005-01-27 21:04 ` Mark Kettenis [this message]
2005-01-27 23:06   ` Andrew Cagney
2005-01-28  8:46     ` Mark Kettenis
2005-01-28 11:43       ` Eli Zaretskii
2005-01-28 18:48         ` Andrew Cagney
2005-01-28 20:21           ` Mark Kettenis
2005-01-29 10:33           ` Eli Zaretskii
2005-01-27 21:05 ` Mark Kettenis

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=200501272103.j0RL3TWS001805@elgar.sibelius.xs4all.nl \
    --to=kettenis@gnu.org \
    --cc=cagney@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    /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