Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Sep 2004 06:00:48 GMT
From:      Giorgos Keramidas <keramida@freebsd.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/71628: [PATCH] cleanup of the usr.sbin/rpcbind code
Message-ID:  <200409130600.i8D60msi015043@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/71628; it has been noted by GNATS.

From: Giorgos Keramidas <keramida@freebsd.org>
To: Dan Lukes <dan@obluda.cz>
Cc: alfred@freebsd.org, bug-followup@freebsd.org
Subject: Re: bin/71628: [PATCH] cleanup of the usr.sbin/rpcbind code
Date: Mon, 13 Sep 2004 08:49:07 +0300

 On 2004-09-13 02:57, Dan Lukes <dan@obluda.cz> wrote:
 >On Sun, 12 Sep 2004, Giorgos Keramidas wrote:
 >> After a quick glance at the source of rpcbind() I think that there's
 >> no way that my_xrpt can be used uninitialized.  A proper fix for this
 >> warning would be then to just set my_xrpt to NULL at first and let
 >> the rest of the function unchanged regarding my_xrpt.
 >
 > 	The unnecesarry initialisation of variable initialised again later
 > seems to be vaste of resources. But IMHO only.
 
 True, but this is not the case here.  If you do initialize the value of
 my_xrpt to something (i.e. to whatever value happens to be held in
 my_xrpt at the time execution reaches the point of its declaration),
 you should at least set it to something that is Right(TM).
 
 This initialization
 
 	char *foo = foo;
 
 is not cheaper than this one:
 
 	char *foo = NULL;
 
 so if you're going to pay the penalty of initializing a variable to
 shuttup the compiler, the second is preferrable because it explicitly
 sets the pointer to a value that cannot be dereferenced.  This will
 catch possible bugs (current or future) in the rest of the code, so
 it's a lot safer.
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200409130600.i8D60msi015043>