Re: [PATCH v2 07/15] rev-list: allow bitmaps when counting objects
From: Junio C Hamano <hidden>
Date: 2020-02-16 23:37:00
Jeff King [off-list ref] writes:
quoted
quoted
+ uint32_t commit_count = 0, + tag_count = 0, + tree_count = 0, + blob_count = 0;Hmm, I don't usually see the comma-separated declaration/initialization in git.git. Is there a reason you did it here? Not that I really mind one way or the other, just interested.The variables are all related, and all should have the same type. I'd complain about a patch that did: int ret, count; because there's no logical reason those two variables have the same type. They just happen to. And putting them both on the same line is even worse, because it makes a diff changing one of them noisy. But in the code quoted above, if one of them changes, they would all (presumably) change. So I think it communicates something to group them like this.
I often apply exactly the same criteria as above to my code and review---since it is not just you (or me), perhaps CodingGuideline can help other readers, but I am OK to delay documenting it until we find the third person who has been applying this rule that has not been spelt out explicitly ;-)