From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32134 invoked by alias); 8 Mar 2011 14:56:51 -0000 Received: (qmail 32126 invoked by uid 22791); 8 Mar 2011 14:56:50 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Mar 2011 14:56:46 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 7736B2BAE83; Tue, 8 Mar 2011 09:56:44 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id QxZCAG9I+oa1; Tue, 8 Mar 2011 09:56:44 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id E7A782BAE02; Tue, 8 Mar 2011 09:56:43 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id D14041459AD; Tue, 8 Mar 2011 18:56:17 +0400 (RET) Date: Tue, 08 Mar 2011 15:30:00 -0000 From: Joel Brobecker To: Pierre Muller Cc: 'Michael Snyder' , gdb-patches@sourceware.org Subject: Re: [RFA] p-typeprint.c, move pointer use to after null-check. Message-ID: <20110308145617.GO30306@adacore.com> References: <4D6D58F2.8070207@vmware.com> <20110308051024.GL30306@adacore.com> <004e01cbdd9d$5d383600$17a8a200$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <004e01cbdd9d$5d383600$17a8a200$@muller@ics-cnrs.unistra.fr> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00538.txt.bz2 > No, I think that the code relies on the fact that physname > is never null, but that the constructor or destructor could have no > parameters, in which case physname would point to \0 > after the '+= 6'. OK, we agree, in fact: > Is this correct: > if (physname && (*physname != 0)) > or is: > if (physname && *physname != 0) > > better? > or should I use: > if (physname && *physname != '\0') My suggestion was to remove the "physname [!= NULL]" part only. Hence: if (*physname != '\0') (I think we have more cases of '\0' than 0 when we're checking character values) -- Joel