On Wed, Jul 06, 2022 at 10:15:51AM +1000, Norman wrote: > 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.
You need to include -Wextra to get the warning. Marek