McCabe Complexity Calcuation and Polymorphism

"Quinn Tyler Jackson" <>
13 Sep 1998 22:27:00 -0400

          From comp.compilers

Related articles
McCabe Complexity Calcuation and Polymorphism (Quinn Tyler Jackson) (1998-09-13)
| List of all articles for this month |

From: "Quinn Tyler Jackson" <>
Newsgroups: comp.compilers
Date: 13 Sep 1998 22:27:00 -0400
Organization: Compilers Central
Keywords: analysis, question


I am currently working on a C++ source code reformatter as a personal
project, and I intend to include a facility displays the member
functions of a class sorted by their McCabe Complexity.

The MC is incremented by one for each decision point in a function, so
I've been wondering if it would make sense to also increment it by one
when a virtual member function is invoked. For instance:

        class Base
                        virtual bool some_func(void);

        class Child : public Base
                        virtual bool some_func(void);
                        void some_other_func(int a);

        void Child::some_other_func(int a)
                if(a > 10)

I calculate the MC for some_other_func to be 2, but it would be 3 if I
were to take the virtualness of some_func into account. Does anyone
have any ideas on this? Pointers to papers?

Thanks in advance,

Quinn Tyler Jackson


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.