[splint-discuss] <variable> = 1;

Frank Hrebabetzky frank at photonita.com.br
Mon Apr 9 08:08:35 PDT 2012


I thought about something like that but hoped there would be a solution 
which less affects the readability of the program.

Thanks for the reply.
-- 
hreba


On 4/9/2012 9:59 AM, Bryan Evenson wrote:
> Just like any other constant that you use a lot, it's better to define a correct sized constant and to use that definition.  For example:
>
> #define UCHAR_0	(unsigned char)0
>
> As long as you're using that to initialize the correct type, it'll pass the Splint checks.
>
> -Bryan
>
> -----Original Message-----
> From: splint-discuss-bounces at cs.virginia.edu [mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of Frank Hrebabetzky
> Sent: Friday, April 06, 2012 12:36 PM
> To: splint-discuss at mail.cs.virginia.edu
> Subject: [splint-discuss]<variable>  = 1;
>
> There are a lot of assignments of 1 and 0 to variables in my program.
> The variables are usually unsigned or char, and splint complains
> because the literals are int.
>
> I don't want to disable type compatibility checks alltogether. Is it
> possible to disable these checks just for literals, or to declare 0
> and 1 as unsigned char?
>
> Thanks


More information about the splint-discuss mailing list