Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order
Rob wrote:
> I disagree - rather than adding a sort call and changing the program's
> runtime complexity, can't we just reduce the amount of lines _and_
> duplication like this:
>
> _AT_@ -89,9 +93,9 @@ entcmp(const void *va, const void *vb)
> const Entry *a = va, *b = vb;
>
> - if(tflag)
> - return sortorder * (b->mtime - a->mtime);
> - else
> - return sortorder * strcmp(a->name, b->name);
> + return sortorder * (tflag ? b->mtime - a->mtime : strcmp(a->name, b->name));
> }
I dissagree. This is harder to read and to understand. Also it gets more complex
when we implement further sort methods (size, ...?).
--Markus
Received on Sat Oct 05 2013 - 12:07:56 CEST
This archive was generated by hypermail 2.3.0
: Sat Oct 05 2013 - 12:12:06 CEST