gcc question ...

Brett Worth brettw at cray.com.au
Wed Sep 19 22:41:02 EST 2001


On Wed, 19 Sep 2001, Burn Alting wrote:

> Just a quick question, is there a warning option to gcc which will warn of
> mixed mode expressions. That is an expression that mixes chars with longs or
> longs with long longs etc.
>
> If not, does anyone know of a C parser that might do such checks?

Burn,

Have you tried lclint?

$ cat m.c
int main()
{
        int i=1, j;
        char c='a';

        j = i + c;

        exit(0);
}
$ lclint m.c
LCLint 2.5r --- 20 August 2001

m.c: (in function main)
m.c:6:6: Incompatible types for + (int, char): i + c
  To make char and int types equivalent, use +charint.

Finished LCLint checking --- 1 code error found

> Burn Alting

Brett

  /) _ _ _/_/ / / /  _ _//
 /_)/</= / / (_(_/()/< ///

 Cray Australia.
 brettw at cray.com +61 2 6295 4023

PGP: 1024R/27EB604F  22A9 A85A 22BD 496B 2443
                     35E5 46F7 0712 27EB 604F





More information about the linux mailing list