terryyin / lizard

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
Other
1.85k stars 250 forks source link

CCN reports increctly for func_b because of func_a "Nested #if" #229

Closed FanJianming closed 6 years ago

FanJianming commented 6 years ago

void func_a() {

int a =1; int b =2;

if 0

ifdef DEBUG

                if(b > a)
                {
                    #if 0
                    if(flr_stat_operation_flag ==TRUE)
                    {
                    }
                    else
                    {
                    #endif
                    printf("%s","a>b");

                    //}

                }

else

     printf("%s","aaa");

endif

endif

}

void func_b(int b) { int a=2; int b=3; if (a > b) printf("%s","a>b");

}

terryyin commented 6 years ago

Yes. Lizard still cannot do preprocessing.

So, in a way, Lizard is counting how complicated the code “looks” from a reader’s perspective gathering from a compiler’s perspective. That’s not entirely true because sometime Lizard counts the wrong function because the brackets in preprocessor.

On 9 Apr 2018, at 6:40 PM, FanJianming notifications@github.com wrote:

void func_a() {

int a =1; int b =2;

if 0

ifdef DEBUG

if(b > a) {

if 0

if(flr_stat_operation_flag ==TRUE) { } else {

endif

printf("%s","a>b");

                //}

            }

else

printf("%s","aaa");

endif

endif

}

void func_b(int b) { int a=2; int b=3; if (a > b) printf("%s","a>b");

}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/terryyin/lizard/issues/229, or mute the thread https://github.com/notifications/unsubscribe-auth/AAwJYkaIIv1AXc06lsHcisRfjPxEQsnSks5tmzqkgaJpZM4TMUYp.