Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
重複の可能性: GCC に幅が広すぎる型を関数に渡すことを警告させることはできますか?
多くの場合、整数関数に long を渡すことでバグが発生します。
私がそれをしているときにgccに警告させることはできますか?
試してみてください-Wconversion。
-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