0
我有一个问题,这一点我的代码:条件跳转或移动依赖于未初始化值
unsigned long me_hash(MEntry *me, unsigned long size){
unsigned long hashval=0;
int i=0;
for(i=0; me->surname[i];i++) hashval +=me->surname[i] + 28 * hashval;;
for(i=0; me->surname[i];i++){
if(me->postcode[i]) {
hashval += me->postcode[i] + 28 * hashval;
}
}
hashval += me->house_number;
return (hashval%size);
}
当我运行Valgrind是
==4480== Conditional jump or move depends on uninitialised value(s)
==4480== at 0x8048EB7: me_hash (mentry.c:66)
==4480== by 0x8048B3E: ml_lookup (mlist.c:91)
==4480== by 0x80488D2: main (finddupl.c:43)
==4480==
我不知道这是我得到的消息知道如何解决这个问题。你可以帮帮我吗?
'me-> surname [i];'或'me-> postcode [i]'是未初始化的?在使用前先打印看看。 – gsamaras 2014-11-08 23:29:57