On 6/28/17 8:41 PM, William Allen Simpson wrote:
This is a good programming practice of long-standing value.

Why of why do these evil commit tests keep creeping in?

bill@simpson91:~/rdma/nfs-ganesha$ git commit --amend -a
WARNING: Comparisons should place the constant on the right side of the test
#17: FILE: src/MainNFSD/nfs_rpc_dispatcher_thread.c:1777:
+    if (XPRT_DONE <= stat) {


Yep, it's another Joe Perches idiocy.  The bane of programmers since he
changed all the if && || tests in 2009 in the Linux network stack to
trailing form.  He tried to put that into checkpatch, and there was a
general uprising -- as there's a lot in kernel NFS code.

Thousands of annoying changes that made it impossible to rebase.

Because of course this is so much more readable:

if (something
#ifdef TEST
              &&
    morestuff
#endif
    ) {


I've been teaching leading constants in C for almost 40 years.  Leading
constants are preferred in many cases, not least because they yield
better compiler error warnings and better code readability.

As do leading && || ....

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nfs-ganesha-devel mailing list
Nfs-ganesha-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel

Reply via email to