Re: [PATCH 2/5] tm.3type: align ranges

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

 



On Tue, Jul 19, 2022 at 01:44:22PM +0200, Alejandro Colomar wrote:
> Hi наб,
> 
> On 7/19/22 03:56, наб wrote:
> > This, to me, makes these much more readable
> > 
> > Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx>
> 
> I like the concept of the commit, but I wonder if we can do it in a better
> way.  I was wondering specifically about moving the ranges to before the
> short description, so that they would be aligned naturally, without needing
> so much whitespace.
> 
> What would you prefer?

I think that either of
  int         tm_sec;    /* Seconds          [0, 60] */
  int         tm_min;    /* Minutes          [0, 59] */
  int         tm_hour;   /* Hour             [0, 23] */
  int         tm_mday;   /* Day of the month [1, 31] */
  int         tm_mon;    /* Month            [0, 11]  (January = 0) */
  int         tm_year;   /* Year minus 1900 */
  int         tm_wday;   /* Day of the week  [0, 6]   (Sunday = 0) */
  int         tm_yday;   /* Day of the year  [0, 365] (Jan/01 = 0) */
  int         tm_isdst;  /* Daylight savings flag */
or
  int         tm_sec;    /* [0, 60]  Seconds */
  int         tm_min;    /* [0, 59]  Minutes */
  int         tm_hour;   /* [0, 23]  Hour */
  int         tm_mday;   /* [1, 31]  Day of the month */
  int         tm_mon;    /* [0, 11]  Month            (January = 0) */
  int         tm_year;   /*          Year minus 1900 */
  int         tm_wday;   /* [0, 6]   Day of the week  (Sunday = 0) */
  int         tm_yday;   /* [0, 365] Day of the year  (Jan/01 = 0) */
  int         tm_isdst;  /*          Daylight savings flag */
is fine, and other options are strictly worse, but went with the former
because (a) the ranges also align the comment trailers so it's easier to
read and (b) it makes more sense to have "description [domain] [bound]"
than "[domain] description [bound]".

I personally prefer the former but the latter would also be fine.

>            int  tm_sec;    /* [0, 60] Seconds */
>            int  tm_min;    /* [0, 59] Minutes */
>            int  tm_hour;   /* [0, 23] Hour */
>            int  tm_mday;   /* [1, 31] Day of the month */
>            int  tm_mon;    /* [0, 11] Month (January = 0) */
>            int  tm_year;   /* Years since 1900 */
>            int  tm_wday;   /* [0, 6] Day of the week (Sunday = 0) */
>            int  tm_yday;   /* [0, 365] Day of the year (Jan/01 = 0) */
>            int  tm_isdst;  /* Daylight savings flag */
Not columnating at least the domain and description is, to me,
a no-go from a readability stand-point.

Best,
наб

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux