From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28543 invoked by alias); 4 May 2005 15:40:16 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 28281 invoked from network); 4 May 2005 15:40:02 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 4 May 2005 15:40:02 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j44Fdpqj028368; Wed, 4 May 2005 11:39:51 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j44FdpO04749; Wed, 4 May 2005 11:39:51 -0400 Received: from [172.16.50.112] (vpn50-112.rdu.redhat.com [172.16.50.112]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id j44FdoDF004607; Wed, 4 May 2005 11:39:50 -0400 Message-ID: <4278EC18.1000308@gnu.org> Date: Wed, 04 May 2005 15:40:00 -0000 From: Andrew Cagney User-Agent: Mozilla Thunderbird 1.0.2-1 (X11/20050323) MIME-Version: 1.0 To: Mark Kettenis , drow@false.org, eliz@gnu.org CC: gdb@sourceware.org Subject: Re: A case for `void *' for pointers to arbitrary (byte) buffers References: <42710E90.3030300@gnu.org> <200504281919.j3SJJKF1011501@elgar.sibelius.xs4all.nl> <42715EE8.5070704@gnu.org> <01c54c8a$Blat.v2.4$ffbe8140@zahav.net.il> <42753958.70109@gnu.org> <01c54e92$Blat.v2.4$5cf24460@zahav.net.il> <42755FD4.8000009@gnu.org> <01c54f4a$Blat.v2.4$a9fc8500@zahav.net.il> <42778DE6.1080106@gnu.org> <200505032013.j43KD1dD005239@elgar.sibelius.xs4all.nl> <20050503202352.GA6424@nevyn.them.org> <200505032113.j43LDOlL013376@elgar.sibelius.xs4all.nl> In-Reply-To: <200505032113.j43LDOlL013376@elgar.sibelius.xs4all.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-05/txt/msg00056.txt.bz2 (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