I’m getting a clang warning from the following third party code in my project:
uLong x ;
int i;
int err;
err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); d
x = (uLong)i; // <- CLANG: Assigned value is garbage or undefined
So to get rid of this error I want to do change the initializing of i to:
int i = 0;
Will that cause any unintended consequences? I want to squash this warning without screwing anything up.
I think you can change it to
int i = 0;.According to your code, initially
ivariable wasn’t initialized, so it could contain arbitrary values, i.e. garbage.I don’t know, and even compiler also doesn’t know, will function
unzlocal_getByteactually change value ofivariable, so it warns you about possible indeterminate state ofivariable.In any case, previously initializing
ivariable will not make situation worse.