CppCheck is flagging the definition of BufLen as an unusedStructMember, even though it is used on the next line to define the length of the array.
(style) struct member 'TxDetails_t::BufLen' is never used. [unusedStructMember]
static struct TxDetails_t
{
static constexpr int32_t BufLen = 128;
uint8_t buffer[BufLen];
uint8_t* ptr;
int32_t num_bytes;
} TxData;
Is CppCheck wrong to report this, or is there a better way for me to define this struct?
This is fixed in the upcoming Cppcheck 2.7. I can reproduce it with 2.6 but not with the latest head.
Looking at the list of fixed issues it appears you encountered https://trac.cppcheck.net/ticket/10485 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.