Formatting very long function parameters

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

 



Hi Michael,

I have a problem with pthread_mutexattr_getpshared(3).
After adding 'restrict', the first parameter alone would use 81 columns,
so I came with 3 options:

A)	Move the parameter to a new line,
	leaving the open parenthesis at the end of a line.

[
       int pthread_mutexattr_getpshared(
const pthread_mutexattr_t *restrict attr,
                                     int *restrict pshared);
       int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
                                     int pshared);
]

B)	Compact the pointer to use only 80 columns,
	by deleting a cosmetic whitespace,
	and exceptionally ignore the 78-column right margin.

[
int pthread_mutexattr_getpshared(const pthread_mutexattr_t*restrict attr,
                                        int *restrict pshared);
       int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
                                        int pshared);
]

C)	(What POSIX does) Break the 1st parameter at the pointer:

[
       int pthread_mutexattr_getpshared(const pthread_mutexattr_t
                                        *restrict attr,
                                        int *restrict pshared);
       int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
                                        int pshared);
]


I did the 1st one, but I'm not sure about it.  Do you have any preference?

This is only problematic when both the function name and the 1st parameter are very long, which is rare, so it shouldn't appear in many pages. I don't expect to find another case. Option B) might not be an option if there are more like this (if those use >82 columns).

Thanks,

Alex

--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/



[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