lundi 29 août 2016

c++ both if and else are not executed-

I have a similar production code

void func(const char *a, int size){ 
...
if(a && size > 0)
{..}
else
{..}
}

though the func works perfectly in most of the cases, in one case it is neither hitting if nor else. I used gdb to verify the the value of a and size. The condition turns out true when I evaluate it with a bool. I have no clue what is happening.

could it be anything to do with memory corruption? I ran valgrind. There is no corruption though there are a lot of memory leaks.

Aucun commentaire:

Enregistrer un commentaire