On Wed, Sep 16, 2009 at 12:25 PM, nathan binkert <[email protected]> wrote: >> It says on the coding guidelines page "Lines must be a maximum of 78 >> characters long". Does that include the space characters used for >> indentation too? > Yes. 78 characters total. There are many reasons that this is a good > policy (and is the policy for python, *bsd, linux, etc) > >> Also, what is the policy of splitting DPRINTF statements over multiple lines? >> >> e.g., >> DPRINTF(XYZ, "THIS IS A DEBUG STATEMENT...", arg1, arg2, arg3, arg4); >> >> to be split up into 2 lines because of the 78 character limit: >> >> DPRINTF(XYZ, "THIS IS A DEBUG STATEMENT...", >> arg1, arg2, arg3, arg4); >> or >> DPRINTF(XYZ, "THIS IS A DEBUG STATEMENT...", >> arg1, arg2, arg3, arg4); >> >> or anything else. > > We don't specify how to indent subsequent lines. There are really > three options I think. Indent 4 more than the previous indent level. > Indent 8 more. Or align with the next scope. Emacs does the last by > default. The first seems obvious, but the second is probably the > nicest when indenting for things like an 'if' statement.
In the particular case of argument lists, you want to line up with the opening paren (as emacs does) as long as that's reasonable. Other than things like DPRINTFs, in my opinion the best policy to deal with really long expressions is often to break your expression up into subexpressions and assign those to temporary variables; it makes your code more readable, and the compiler doesn't care. Steve _______________________________________________ m5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/m5-dev
