This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [commit] Tighten memory read/write methods
- From: Mark Kettenis <kettenis at gnu dot org>
- To: cagney at gnu dot org
- Cc: gdb-patches at sources dot redhat dot com
- Date: Thu, 27 Jan 2005 22:03:29 +0100 (CET)
- Subject: Re: [commit] Tighten memory read/write methods
- References: <41F94AE7.4020405@gnu.org>
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