From: Larry D. <ldo...@re...> - 2008-02-18 22:12:23
|
Steve - On Mon, Feb 18, 2008 at 11:45:03AM -0800, Stephen Williams wrote: > [chop] But I do insist that the code should be viewed > the way the writer wrote it. In particular, it bothers me immensely > when I see source code clearly written by a vi user with tabs set to > 4. It's unreadable! Either do not use tab characters (i.e. leading > spaces instead) or stick to the standard tab=8 and use tab followed > by spaces to get the desired position. > > I think the above pretty much rules out BusyBox coding style as I grasp > them from this conversation since an 8-place tab for every indent would > be hopelessly too deep for code with any nesting complexity. There are two orthogonal answers for this: 1. Don't indent so deeply. 2. Set your tab=6. > Expecting code format to survive viewers adjusting indent for > personal taste is unrealistic. Properly used, the busybox style looks fine no matter what you set your tabstops to. Don't take my word for it, open up a recent copy of busybox and see how it looks. Try it with tab=4, tab=6, and tab=8. Then re-read the busybox style guide to see how it's done. Specifically, the first file I looked at is coreutils/expand.c. It gets up to about 6 indent levels, and mostly fits into 80 columns at tabs=8. I'm sure Steve will like its look better at tabs=6, and you can de-emphasize the nesting (and make the longest line fit 80 columns) by setting tabs=2. There are a couple of places where spacing within the line is important, and that's done with spaces: see the initial comment block, the enum declaration of OPT_{INITIAL,TABS,ALL}, and the declarations of {,un}expand_longopts[]. The point is kind of like original (pre-commercialization and pre-web-designer) html concept: encode semantics in the document, in this case by using a number of tabs to represent nesting level. Presentation (physical spacing) is left up to the browser and individual choice. - Larry |