From owner-freebsd-bugs@FreeBSD.ORG Mon Sep 13 06:00:53 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5839316A4CF for ; Mon, 13 Sep 2004 06:00:53 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 461D643D5F for ; Mon, 13 Sep 2004 06:00:53 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i8D60r0b015131 for ; Mon, 13 Sep 2004 06:00:53 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i8D60r1m015130; Mon, 13 Sep 2004 06:00:53 GMT (envelope-from gnats) Date: Mon, 13 Sep 2004 06:00:53 GMT Message-Id: <200409130600.i8D60r1m015130@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Giorgos Keramidas Subject: Re: bin/71630: [PATCH] cleanup of the usr.sbin/pppd code X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Giorgos Keramidas List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2004 06:00:53 -0000 The following reply was made to PR bin/71630; it has been noted by GNATS. From: Giorgos Keramidas To: Dan Lukes Cc: bug-followup@freebsd.org Subject: Re: bin/71630: [PATCH] cleanup of the usr.sbin/pppd code Date: Mon, 13 Sep 2004 08:54:34 +0300 On 2004-09-13 03:07, Dan Lukes wrote: > On Sun, 12 Sep 2004, Giorgos Keramidas wrote: > >On 2004-09-12 04:38, Dan Lukes wrote: > >>- FILE *iffile; > >>+ FILE *iffile = iffile; /* to avoid "may be used unitialized" warning */ > > > >Nope. NULL is the proper initialization value for (FILE *) objects. > >This way any bugs that might exist further down will be exposed by a > >dereference of a NULL pointer which everyone will notice. Hiding the > > True initialisation is not necesarry with current code, so it's waste of > resources now. > > I like defensive style of programming, but it has negative impact on > performance. The impact is not greater than the impact of the bogus initialization shown above though. The only difference is the extra safety the NULL initialization buys us. > Somebody should evaluate if we can live with unnecesarry initialisation > here. If yes, it's better patch to iffile=NULL, if not, my patch is > better. The initialiation you suggested will result in the same sort of extra code, if not more. It also invokes implementation defined behavior, which is Evil(TM) and should be avoided if possible; even with a slight increase in the cost (which is not the case here, but anyway). Another thing to note is that the initialization of pointers to NULL is so common that some compilers might use special optimization tricks to reduce the impact you mention.