From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12484 invoked by alias); 11 Dec 2012 12:01:29 -0000 Received: (qmail 12470 invoked by uid 22791); 11 Dec 2012 12:01:28 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO 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, 11 Dec 2012 12:01:19 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id AB79B2E2F5; Tue, 11 Dec 2012 07:01:18 -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 JEsaaRlO02pK; Tue, 11 Dec 2012 07:01:18 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 34E222E2F4; Tue, 11 Dec 2012 07:01:18 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 97A6DC3B05; Tue, 11 Dec 2012 16:00:57 +0400 (RET) Date: Tue, 11 Dec 2012 12:01:00 -0000 From: Joel Brobecker To: Pedro Alves Cc: Jan Kratochvil , gdb-patches@sourceware.org, Matt Rice Subject: Re: [doc patch] coding style: 0 vs. NULL + [patch] Code cleanup: skip.c Message-ID: <20121211120057.GO31477@adacore.com> References: <20121210184220.GA29321@host2.jankratochvil.net> <20121211015343.GM31477@adacore.com> <20121211060641.GA7775@host2.jankratochvil.net> <50C7093F.5000600@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50C7093F.5000600@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2012-12/txt/msg00317.txt.bz2 > > I find '(first)' OK myself but IIRC Pedro recently in some mail > > wrote he likes more an explicit NULL comparison there. Although I > > cannot find his mail now so I hope I do not put these words in > > Pedro's mouth. > > Yes, indeed I mentioned it recently somewhere. Personally, I find > implicit boolean conversions make the code harder to grok, so I prefer the > latter. Same here. I tend to prefer explicit checks. From a purely accademic, sadistic, theoretical perspective, NULL isn't required to be zero, is it? The C99 draft I have says... expands to an implementation-defined null pointer constant ... and I know some architectures did use nonzero null pointers. > That's about the same level of badness as '!strcmp(a, b)' to me. Argh, yes, I hate those :-). -- Joel