Hi Matti,

Matti Karnaattu wrote on Wed, Sep 24, 2014 at 12:55:14PM +0300:

> I got confused for that monster main function.
> That is definitely overly complex

I strongly disagree.

That main function is good, standard style.
Actually, it's good enough to be shown off as an example.
A small utility should be written just like that.

It has one small getopt(3) loop, decrements argc/argv, has one small
codeblock to handle arguments for each variant of the utility, and
one concise fts(3) main loop to handle files, and finally a one-liner
for error handling.

The function is nearly linear, it's very easy to read.
Complication definitely looks *way* different.

> and that *ep looked like a forgotten.
> 
> Hmm.. I counted cyclomatic complexity..
> and that is 65 in main function :|

So what's the point?  You can't *calculate* whether something is
readable for a *human*, and that's what matters.

Please forget about such purely theoretical calculations right now.

Yours,
  Ingo

Reply via email to