bin/71628: [PATCH] cleanup of the usr.sbin/rpcbind code
dan at obluda.cz
Sun Sep 12 20:59:22 PDT 2004
Dima Dorfman wrote:
> Any initialization in the form "T v = v" invokes undefined behavior by
> using the indeterminate value of an object. Eliminating a warning or
Unless compiler documentation say other ...
The v=v DURING DECLARATION (not later) is special case.
Even on non GCC compiler it didn't make things worse - the value of v
has not been changed by v=v statement ...
> compiler can't be convinced that the variable is never used before
> being initialized, please initialize it to something obviously bogus.
It can be convicted, by "v=v" trick during declaration of variable.
It's hack, of course.
It seems to be similar to "declared but newer used" warning. It is
eliminated by compiler specific hack also ("__unused")- not by true
usage of variable. So my recommended way seems to be consistent with
current code style with no unnecesarry impacts to final executed code
(you know - we correct GCC's problem, not bug within the code)
But I'm far away from pushing this way to eliminate warnings. It's no
problem to initialise variable to constant for me (I hope those patches
will not be rejected "because the initialisation is not necesarry as
variable is properly initialised later")
If you thing those patches can't be used (with or without corrections
you recommended) then close the PR
Thank you for your comment.
More information about the freebsd-bugs