Hi all,

Consider this bit of code:

unsigned int d=1,e=2,f;

    if((d-e) < 0)
        {
        f=d-e;
        printf("f=%i",f);
        }

gcc  -Wall -DLinux -D_FILE_OFFSET_BITS=64 -c scroll.c

gcc compiles this without a whimper.

However the expression (d-e) < 0 always evaluates to false (0). gcc type casts (d-e) as unsigned.

Also the assignment f=d-e; probably should not be allowed.

I would have expected  warnings from gcc at least.

For your consideration,

Regards,

Norman Davis

Reply via email to