From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S269630AbTGJWBq (ORCPT ); Thu, 10 Jul 2003 18:01:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S269628AbTGJV71 (ORCPT ); Thu, 10 Jul 2003 17:59:27 -0400 Received: from neon-gw-l3.transmeta.com ([63.209.4.196]:260 "EHLO neon-gw.transmeta.com") by vger.kernel.org with ESMTP id S269635AbTGJV54 (ORCPT ); Thu, 10 Jul 2003 17:57:56 -0400 To: linux-kernel@vger.kernel.org From: "H. Peter Anvin" Subject: Re: Style question: Should one check for NULL pointers? Date: 10 Jul 2003 15:12:02 -0700 Organization: Transmeta Corporation, Santa Clara CA Message-ID: References: <3F0DD21B.5010408@inet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT Disclaimer: Not speaking for Transmeta in any way, shape, or form. Copyright: Copyright 2003 H. Peter Anvin - All Rights Reserved Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Followup to: <3F0DD21B.5010408@inet.com> By author: Eli Carter In newsgroup: linux.dev.kernel > > Alan Stern wrote: > [snip] > > Ultimately this comes down to a question of style and taste. This > > particular issue is not addressed in Documentation/CodingStyle so I'm > > raising it here. My personal preference is for code that means what it > > says; if a pointer is checked it should be because there is a genuine > > possibility that the pointer _is_ NULL. I see no reason for pure > > paranoia, particularly if it's not commented as such. > > > > Comments, anyone? > > BUG_ON() perhaps? > BUG_ON() is largely redundant if you would have a null pointer reference anyway. -hpa -- at work, in private! If you send me mail in HTML format I will assume it's spam. "Unix gives you enough rope to shoot yourself in the foot." Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64