LWN.net Logo

Eight character tabs

Eight character tabs

Posted Oct 31, 2012 18:52 UTC (Wed) by nix (subscriber, #2304)
In reply to: Eight character tabs by etienne
Parent article: Thoughts on the ext4 panic

I don't understand your debug printf() comment at all. You can always break a printf() line, even in the format string, with string literal concatenation.


(Log in to post comments)

Eight character tabs

Posted Nov 1, 2012 9:41 UTC (Thu) by ncm (subscriber, #165) [Link]

Me, I've never understood why people insist that printf format strings should be indented at all. I push them to the left margin, and it brings no confusion, but much clarity.

Eight character tabs

Posted Nov 1, 2012 12:06 UTC (Thu) by etienne (subscriber, #25256) [Link]

But most of the time you want to understand the structure of the function you are about to modify, even if you have (probably commented) printf's showing that you entered the function with those parameters, that you are calling that other function with those parameters, what is the value of each of the fields of that structure...
Having 3/4 lines of code with no algorithm meaning does not help to see the structure of the code and is difficult to comment/uncomment at once; it is easier to tell your editor not to wrap lines and so not display the end of those (probably commented) lines.
Obviously you can write the functions print_mystruct_and_cpt(), print_mystruct_and_idx(), ... that you call only once in a commented out block.
Linux source do not have much "logging" lines, so it is not a real problem there.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds