[RFC v2] Pretty printers for NPTL lock types

Mike Frysinger vapier@gentoo.org
Fri Mar 13 18:32:00 GMT 2015


On 13 Mar 2015 14:48, Martin Galvan wrote:
> On Fri, Mar 13, 2015 at 2:47 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> > On 12 Mar 2015 14:33, Martin Galvan wrote:
> >>         else:  # Mutex is locked
> >>             if self.lock & FUTEX_WAITERS:
> >
> > i prefer to avoid inline comments
> 
> I've been looking at the code again and IMHO, save for perhaps that
> one comment, the rest of the inline comments should stay. The ones
> beside the "else"s are helpful for maintainers to know what my
> assumptions were for that particular else, i.e. which cases I
> predicted would go through that path. Any cases not mentioned in the
> else comment nor the previous if/elifs are a sign of a possible bug,
> or at least a reminder for maintainers who have to implement a new
> case.
> 
> The comments by the globals are useful to identify what they'll be
> used for without having to search through the code, and the comment
> inside MutexPrinter's printAttributes method tells of an inconsistency
> inside the NPTL itself.

i'm not saying delete the comments.  i'm saying comments should not be inline.

incorrect:
	CONSTANT = 0x213  # Blah
	...
	else:  # Some foo
		blah = 0

correct:
	# Blah.
	CONSTANT = 0x213
	...
	else:
		# Some foo.
		blah = 0
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150313/4e47da56/attachment.sig>


More information about the Libc-alpha mailing list