logo       

Re: Indenting the source: msg#00038

lang.nasm.devel

Subject: Re: Indenting the source

H. Peter Anvin wrote:
Ed Beroset wrote:


Therefore, while HPA's line specifies more (which is a good thing, IMHO) the only actual *differences* are as follows:

Ed: -ci8 -nlp
HPA: -ci4 -lp

To borrow an example from the indent man pages, the difference would look like this with -ci8 -nlp:

p1 = first_procedure (second_procedure (p2, p3),
third_procedure (p4, p5));

With -ci4 -lp in effect the code looks like this:

p1 = first_procedure (second_procedure (p2, p3),
third_procedure (p4, p5));


Because these are minor differences, I could endorse either, but I would very much like to have one consistently applied style throughout, no matter what that style.


OK, both of those I feel fairly strongly about. I really want the difference between statements like if, for, and while and function calls, and NASM, like most compilers, is really way too nested to be well handled by an indentation level of 8 and still have space for comments.

Linus doesn't believe in comments, so he advocates indentation by 8. To quote Andrew Morton, "however, I do."

I think you may misunderstand the difference. The -ci8 is just the *continuation* indent, meaning a single long line of code is wrapped and indented by 8. The -i4 means that the normal indentation is still 4, as we both have indicated we prefer. Most of the code seems to be in that style already.

Also, by preferring -lp instead of -nlp, you actually leave less room for comments, not more. The example statements above illustrate both of these points. The -lp version has the function arguments lined up vertically, and the -nlp -ci8 just indents the second line by 8 spaces instead as many as it takes to line up the parameters.

If this is OK with everyone else, I'll run indent over the sources and check those in as a separate checkin. It's still a flag day -- you effectively lose all change tracking across the reformat -- but at least there are no other changes involved.

Yes, I'd strongly endorse this, but only if we agree first on which style to use. As you say, it's a flag day, and so we'd better only do it once!

Ed



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise