Re: on goto

James Dow Allen <jdallen2000@xxxxxxxxx> wrote:
On May 19, 7:42 pm, "bart.c" <ba...@xxxxxxxxxx> wrote:
James Dow Allen wrote:

Another grown man felt the need to post flowchart
comparisons that blithely ignored that (A && B)
is more "complicated" than (B).  If it isn't clear what
I'm driving at then run this code through your "tool":
     A = B ? C : D;

     if (B)
         AA = C;
         AA = D;
If your tool tells you the first form above is simpler,
would you agree the tool is flawed?


??? Yourself!
The (irrelevant) use of an alternate name was just
so no smart-aleck would argue that the first
statement gets optimized out!

Whether A or AA, this potentially complex term has to be repeated. This form
also encourages you to spread it over 4 lines instead of 1, which can have
the effect of expanding the surrounding statement or function enough to make
it harder to take in at a glance.

You miss the point. Of course I am *NOT* arguing against the simpler
expression here, just pointing out that a conditional is a conditional
whether it uses the keystrokes "if", "?:" or even "&&".

I was rebutting another poster who claims that his *more* complicated
code is, instead *equally* complicated just because *his tool* treats
(A && B)
as *equally* complicated*, even though the tool recognizes "if" as

I hope my point isn't too ... er ... complicated :-)

I think the point though is that his tool (i.e., cyclometric complexity)
is meant to measure the number of unique paths through the code in
question. If neither 'A' nor 'B' have side effects, then A && B isn't
any more complex than B (based on the definition of complexity