The page actually does mention using temporary variables for splitting
long expressions. But it does not mention anything about the DPRINTF
statements. These statements can be very long and splitting them up
using the rule for expressions does not apply to them.

Thank you for your replies.

regards,
Soumyaroop.

On 9/16/09, Steve Reinhardt <[email protected]> wrote:
> 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
>


-- 
Soumyaroop Roy
Ph.D. Candidate
Department of Computer Science and Engineering
University of South Florida, Tampa
http://www.csee.usf.edu/~sroy
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to