Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v2] Rewrite fsck.c:fsck_commit() replace memcmp() with starts_with()

From: Matthieu Moy <hidden>
Date: 2016-06-15 23:00:25

blacksimit [off-list ref] writes:

-
+    int magic_num;
+    
+    magic_num = strlen("tree "); /* magic_num is 5 */
 	if (!starts_with(buffer, "tree "))
Whitespace damage. It seems you have set your tab-width to something
other than 8, and indented with spaces. Please don't do either.
+    magic_num = strlen("committer"); /* magic_num is 7 */
Typical example of a counter-productive comment. A good comment usually
explains _why_ the code is as it is, and not _what_ it is doing. C is a
much better lanuage than english to describe algorithm, so if you want
magic_num to become equal to 7, then write "magic_num = 7" in code, not
in a comment.

Here, the reader has to spend time and energy to check the
correspondance between the code and the redundant comment ... and see
than they do not match!

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help