Make gcc a warning for implicit conversions

Possible duplicate:
Can I warn GCC about passing too wide types to functions?

Many times I cause errors by passing a long integer function.

Can I get gcc to warn me when I do this?

+3
source share
1 answer

Give it a 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 ‘intfromlong int’ may alter its value
+7
source

All Articles