Possible Duplicate:
Can I make GCC warn on passing too-wide types to functions?
Many times I cause bugs by passing a long to an integer function.
Can I make gcc warn me when I'm doing that?
Try -Wconversion
.
int fn(int);
int bar(long x) { return fn(x); }
gcc -c t.c -Wconversion
t.c: In function ‘bar’:
t.c:3: warning: conversion to ‘int’ from ‘long int’ may alter its value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With