On Wed, Feb 16, 2011 at 08:32:06PM -0800, Linus Torvalds wrote: > On Wed, Feb 16, 2011 at 8:25 PM, J. Bruce Fields <bfields@xxxxxxxxxxxx> wrote: > > - Â Â Â Â Â Â Â if ((host_err = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid))) > > - Â Â Â Â Â Â Â Â Â Â Â goto out_nfserr; > > + Â Â Â Â Â Â Â if ((status = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid))) > > + Â Â Â Â Â Â Â Â Â Â Â return status; > > Btw, can we please just agree to not doing those idiotic double parenthesis? Fine by me; I don't write new code that way. I already committed it like that, so would rather just do any cleanup as another patch for the next merge window; but let me know what you want. --b. > > There is a really trivial solution to the gcc warning - write your > code like a sane person, instead of some ex-LISP hacker that has > withdrawal symptoms. IOW, the above should be written as > > status = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid); > if (status) > return status; > > which is a hell of a lot more readable, no? > > There is never any real excuse to put an assignment inside a regular > if-statement. > > Inside a while/for loop? Sure. There are real syntactic reasons for > doing things like > > while ((c = getchar()) != EOF) { > } > > that actually make the code better and denser and avoid extra control > flow crap or duplicate code. > > Inside a macro expansion? Again, there may be good reasons to try to > make it a single statement. > > But a simple if-statement? There just isn't any reason for it, since > the obvious thing is to just write it as two separate statements: the > assignment, and the if-statement. So why do it and make the code > uglier and harder to parse? > > Linus -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html