Make gcc warn implicit conversions

c, gcc, warnings

Solution

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

Problem

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?

Original source

Related problems