bug-standards
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: indentation uncertainty


From: Alfred M. Szmidt
Subject: Re: indentation uncertainty
Date: Fri, 09 Feb 2018 11:31:22 -0500

   >        return rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
   >          + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000;

   > I'd consider this improper, since it puts the operator where it
   > doesn't belong

   Why does not belong IYHO?

The coding standards recommend that the expression follows below it
self.  That is, we don't write:

  mode = inmode[j] == VOIDmode
    || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j])
    ? outmode[j] : inmode[j];

But rather position "|| ..." below the RHS part of the expression.
Ignoring nesting, and with the extra parens. so that Emacs does the
right thing this being the canonical "nice" example:

  mode = (inmode[j] == VOIDmode
          || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j])
          ? outmode[j] : inmode[j]);

That is in the examples you gave, + being located directly under the
return keyword is "improper", it should instead be located under
rup->ru_utime.tv_sec.

I don't see the difference between "mode =", sizeof, or return.  Which
is also why I don't see why clarification is needed, but on the other
hand ... clarification cannot hurt. :-)

   Now, given that there is disagreement even here, I wonder if this is the
   proper forum to determine what the fix to the recommendation should be.
   Should I take it elsewhere, or is this the right forum to debate what
   the GNU general recommendation should be?

This is probobly the right forum, I would suggest maybe adding
addition examples, or maybe simply mentioning that the same rules
apply for sizeof/return/... 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]