Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What am I doing wrong in this lint error suppression attempt? And is there a better way?

Tags:

c++

lint

pc-lint

I have the following line of code:

ftDCB.ByteSize = FT_BITS_8;

And lint (PC-lint via Visual Lint, specifically) gives me a message 1924 on it ("C-style cast -- More Effective C++ #2").

FT_BITS_8 is #defined in a third party header file, and there's where the cast is:

#define FT_BITS_8           (UCHAR) 8

And UCHAR is a typedef from another third party header file:

typedef unsigned char UCHAR;

The thing it's being assigned to (ftDCB.ByteSize) is a BYTE, which is also a typedef for an unsigned char:

typedef unsigned char       BYTE;

I don't really want to modify the third-party headers, so I tried to suppress the message in my code:

//lint -e(1924) C-style cast
ftDCB.ByteSize = FT_BITS_8;

But I get the same 1924 message.

What am I doing wrong here? And is there a cleaner way to do what I want to accomplish (other than modifying the third-party header)?

like image 444
Bob Vesterman Avatar asked Dec 17 '25 11:12

Bob Vesterman


1 Answers

OK, answering my own question, the following seems to work:

ftDCB.ByteSize = /*lint -e(1924) C-style cast */ FT_BITS_8;
like image 94
Bob Vesterman Avatar answered Dec 19 '25 01:12

Bob Vesterman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!