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: Wed, 07 Feb 2018 12:29:36 -0500

   Would any of the following 4 forms be deemed improper in GNU code?

All of this is IMHO.

       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 Emacs will reindent it -- thus some
parens are needed.

       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);

Fine, as this puts the operator where it belongs -- with the rest of
the expression.

       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 (i.e. same as if you indent the example code in the
GCS).  This is also the result when indenting in Emacs.

       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);

Fine, since maybe the first line contains a very long identifier or that
it makes it legible -- same for if and while.

   If any of them are, the addition, to the standard document, of the
   snippet and rationale would be appreciated.

I am not sure if an addition is needed, the above example fit with the
proper and improper examples from the standard document.



reply via email to

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