Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>, drow@false.org, eliz@gnu.org
Cc: gdb@sourceware.org
Subject: Re: A case for `void *' for pointers to arbitrary (byte) buffers
Date: Wed, 04 May 2005 15:40:00 -0000	[thread overview]
Message-ID: <4278EC18.1000308@gnu.org> (raw)
In-Reply-To: <200505032113.j43LDOlL013376@elgar.sibelius.xs4all.nl>

(yet again something ate my e-mail, I'm reading from the web)

Mark described the problem as:
> In many places GDB needs to pass along and pick apart blobs of memory.
> In many cases, GDB does this using `char *' pointers.  Small blobs of
> memory are often allocated on the stack as `char[]' or `unsigned
> char[]'.

This is not correct.  'void *' is more applicable to arbitrary opaque 
objects.  Here, though, we know the object's type (a byte buffer) and 
hence should use that.  Daniel correctly explains it thus (from a 
disconnected thread):

> These are byte-oriented buffers, so using a type where we can perform
> byte-oriented arithmetic without superfluous casts seems like a good
> choice to me.  Converting to void * (and not using the GCC extension
> which allows arithmetic on void *) would be a painful process.

(And as someone that actually thought to try out the two alternatives 
and determine the damage, I can tell you that void* and casts totally sux.)

Also, in support of this move away from void*, BINUTILS, several months 
ago, and in response to this rumored warning, re-vamped their types 
moving more strongly towards bfd_byte* (one consequence was that I had 
to update some of GDB's interfaces).

As for the names bfd_byte vs gdb_byte that really is arbitrary.  To 
ensure that our byte buffers are compatible with BFDs we'll want to use 
"typedef bfd_byte gdb_byte" anyway.  Given that we're already doing 
similar for LONGEST, ADDRESS, et.al., that shouldn't be contraversial.

Anyway, since the prefered name is "gdb_byte", and that was Eli's idea, 
I think it is fit and proper that Eli take the honours.   Can we get it 
done by tomorrow?   If not let me know (Hopefully I can now go back to 
fixing my GCC 4 warnings).

Andrew


  parent reply	other threads:[~2005-05-04 15:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <42710E90.3030300@gnu.org>
     [not found] ` <200504281919.j3SJJKF1011501@elgar.sibelius.xs4all.nl>
     [not found]   ` <42715EE8.5070704@gnu.org>
     [not found]     ` <01c54c8a$Blat.v2.4$ffbe8140@zahav.net.il>
     [not found]       ` <42753958.70109@gnu.org>
     [not found]         ` <01c54e92$Blat.v2.4$5cf24460@zahav.net.il>
     [not found]           ` <42755FD4.8000009@gnu.org>
     [not found]             ` <01c54f4a$Blat.v2.4$a9fc8500@zahav.net.il>
     [not found]               ` <42778DE6.1080106@gnu.org>
2005-05-03 20:17                 ` Mark Kettenis
2005-05-03 20:23                   ` Daniel Jacobowitz
2005-05-03 21:14                     ` Mark Kettenis
2005-05-03 21:16                       ` Daniel Jacobowitz
2005-05-03 22:10                         ` Mark Kettenis
2005-05-03 22:28                           ` Daniel Jacobowitz
2005-05-03 22:31                             ` Joel Brobecker
2005-05-04 14:45                             ` Mark Kettenis
2005-05-04 20:36                               ` Eli Zaretskii
2005-05-04 15:40                       ` Andrew Cagney [this message]
2005-05-04 17:57                         ` Eli Zaretskii
2005-05-03 22:01                   ` Stan Shebs

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=4278EC18.1000308@gnu.org \
    --to=cagney@gnu.org \
    --cc=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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