[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: the C coding style in lua sources
- From: Axel Kittenberger <axkibe@...>
- Date: Wed, 26 Jan 2011 16:31:25 +0100
But it uses more lines!
"I'm a better code than you cause I did the same thing with less lines"!
That's why source code comments are also to be added only where they absolutely must be. Function headers are evil cause they make more lines!
I don't know how many times I've argued and soon got verbal commitment the measurement for complexity/efficiency should be if tokens and never lines. But subconsciousply this brute view of "Have to reduce lines" mantra still is effective.
Am 26.01.2011 15:57 schrieb "François Perrad" <firstname.lastname@example.org
> This is not about aesthetics.
> The sources use a consistent coding style and it is a right thing.
> But this style is not friendly with some tools like debugger or code
> coverage analysor.
> For example (from luaB_select):
> if (i < 0) i = n + i;
> else if (i > n) i = n;
> could be rewritten :
> if (i < 0)
> i = n + i;
> else if (i > n)
> i = n;
> This allows to set breakpoint on condition and on instruction,
> and the code coverage analysis doesn't mix condition & instruction.
> The attached script lgrep allows to find all occurences
> $ lgrep "if %b()%s+%l" *.c *.h
> Now, a personal preference, please remove also the trailing spaces
> $ lgrep "%s$" *.c *.h
> Note: You could find a full example of code coverage here