Hi, not sure if this is realistic to fix. Strictly speaking, the variable is used but only indirectly, via a struct that holds a pointer to the array.
//cppcheck 2.8. //cppcheck test.c --enable=style // => style: Variable 'txdata[0]' is assigned a value that is never used. [unreadVariable] struct msg { char *data; }; //this next line is optional and changes nothing extern void sendstuff(struct msg *txmsg); void main(void) { struct msg txmsg; char txdata[2]; txmsg.data = txdata; txdata[0]=0x55; //this next line is optional and changes nothing sendstuff(&txmsg); }
Thanks! I definitely consider this as a false positive we should fix.
I have created ticket: https://trac.cppcheck.net/ticket/11139
Log in to post a comment.
Hi,
not sure if this is realistic to fix. Strictly speaking, the variable is used but only indirectly, via a struct that holds a pointer to the array.
Thanks! I definitely consider this as a false positive we should fix.
I have created ticket: https://trac.cppcheck.net/ticket/11139