[splint-discuss] Very strict cast checking

Marco.Giromini at marconiselenia.com Marco.Giromini at marconiselenia.com
Fri Sep 26 13:13:50 EDT 2003


I obviously can.
Anyway I don't like to receive such warning for legacy code, while I still
want a warning for y=x;

Regards
Marco Giromini



Can't you just say

    y = (char)2;

And be done?

=Austin

--- Marco.Giromini at marconiselenia.com wrote:
> Some sort of compatibility rules should be useful for integer
> constants
> v.s. other predefined types.
> This is particularly true for the "char" predefined type.
> For other types the following suffix could be used (but not for
> legacy
> code):
> unsigned-suffix: one of u U
> long-suffix: one of l L
> long-long-suffix: one of ll LL
>
> For instance, in:
>    int x;
>    char y;
>    y=x; /* flag this */
>    x=1; /* don't flag this */
>    y=2; /* don't flag this */
>
> Anyway I get:
>       Assignment of int to char: y=2
>       To make char and int types equivalent, use +charint
>
> But I don't want to use +charint, otherwise I would loose the warning
> for y=x;
>
> Could anyone help me please ?
> Marco Giromini
>
> ---------------------- Forwarded by Marco Giromini/MAIN/MC1 on
> 09/26/2003
> 12:04 PM ---------------------------
>
> Derek M Jones <derek at knosof.co.uk>@cs.virginia.edu on 08/21/2003
> 08:50:42
> PM
>
> Please respond to splint-discuss at cs.virginia.edu
>
> Sent by:    splint-discuss-admin at cs.virginia.edu
>
>
> To:    splint-discuss at cs.virginia.edu
> cc:
>
> Subject:    Re: [splint-discuss] Very strict cast checking
>
> ...
>
> However, simply treating typedef names as distinct types is too
> simplistic.  Some sort of compatibility rules have to be worked out
> for
> integer constants.  For instance, in:
>
> typedef int MY_INT;
> int x;
> MY_INT y;
>
> x+y; /* flag this */
> x+1; /* don't flag this */
> y+1; /* don't flag this */
>
>
>
> _______________________________________________
> splint-discuss mailing list
> splint-discuss at cs.virginia.edu
> http://www.splint.org/mailman/listinfo/splint-discuss

_______________________________________________
splint-discuss mailing list
splint-discuss at cs.virginia.edu
 http://www.splint.org/mailman/listinfo/splint-discuss







More information about the splint-discuss mailing list