Cppcheck will throw this style error on this section of code
"Variable 'u.i' is assigned a value that is never used."
I think this is a false positive, because u.i does get used, just in the form of u.f in the following statement.
int main (void) { union { uint32_t i; float f; } u; u.i = 0x41200000; int d = u.f + 5; printf("d = %d\n", d); return 0; }
This is related to this issue: https://trac.cppcheck.net/ticket/8909
I created a separate ticket for this: https://trac.cppcheck.net/ticket/9226
Log in to post a comment.
Cppcheck will throw this style error on this section of code
"Variable 'u.i' is assigned a value that is never used."
I think this is a false positive, because u.i does get used, just in the form of u.f in the following statement.
This is related to this issue: https://trac.cppcheck.net/ticket/8909
I created a separate ticket for this: https://trac.cppcheck.net/ticket/9226