From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27987 invoked by alias); 12 Jan 2007 12:30:20 -0000 Received: (qmail 27979 invoked by uid 22791); 12 Jan 2007 12:30:19 -0000 X-Spam-Check-By: sourceware.org Received: from centrmmtao03.cox.net (HELO centrmmtao03.cox.net) (70.168.83.81) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 12 Jan 2007 12:30:12 +0000 Received: from eastrmimpo01.cox.net ([68.1.16.119]) by centrmmtao03.cox.net (InterMail vM.6.01.06.03 201-2131-130-104-20060516) with ESMTP id <20070112123009.TAND13993.centrmmtao03.cox.net@eastrmimpo01.cox.net>; Fri, 12 Jan 2007 07:30:09 -0500 Received: from black ([70.181.32.198]) by eastrmimpo01.cox.net with bizsmtp id ACUl1W00R4GV2Jm0000000; Fri, 12 Jan 2007 07:28:45 -0500 Received: from bob by black with local (Exim 4.62) (envelope-from ) id 1H5LXs-00053j-58; Fri, 12 Jan 2007 07:30:08 -0500 Date: Fri, 12 Jan 2007 12:30:00 -0000 From: Bob Rossi To: Mark Kettenis Cc: vladimir@codesourcery.com, gdb@sources.redhat.com Subject: Re: MI failures related to string printing Message-ID: <20070112123008.GA5540@cox.net> Mail-Followup-To: Mark Kettenis , vladimir@codesourcery.com, gdb@sources.redhat.com References: <200701121351.29310.vladimir@codesourcery.com> <200701121118.l0CBIh7p011299@brahms.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200701121118.l0CBIh7p011299@brahms.sibelius.xs4all.nl> User-Agent: Mutt/1.5.12-2006-07-14 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00209.txt.bz2 On Fri, Jan 12, 2007 at 12:18:44PM +0100, Mark Kettenis wrote: > I think the whole idea of doing string comparisons for C (or C++) > "char *" pointers is flawed. There is no guarantee that a "char *" > actually points to a null-terminated as the test shows. You should > not treat "char *" any different from other pointers like "int *", at > least not by default. You could implement a way for the user to > specify that a "char *" is actually a pointer to a string instead of a > single character. But otherwise I think the string comparison should > only do for languages that have a genuine string type, such as Pascal. GDB handles char*'s specially in the print command. There is an option to tell it that the string shouldn't be displayed as null-terminated. I think it's appropriate to handle the char* special as long as there is an option not to do so. Bob Rossi