On Tue, 10 Jun 2008 08:53:39 -0400 Neil Horman <nhorman@tuxdriver.com> wrote:
Not silly, really. Look:
err = -ENOMEM;
if (expr1)
goto out;
err = -ENOMEM;
if (expr2)
goto out;
each of these two units is a separate, self-contained clause. Removing
the second assignment to `err' breaks that separation and will make one
clause undesirably dependent upon the other.
Example: if someone later comes up and does
err = -ENOMEM;
if (expr1)
goto out;
+ er = -EINVAL;
+ if (expr3)
+ goto out;
if (expr2)
goto out;
then whoops, it broke.
The compiler should optimise away the second assignment anyway.
--