This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Implicit type conversion check
- From: Pierre Chatelier <pierre dot chatelier at club-internet dot fr>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 30 Nov 2006 11:47:37 +0100
- Subject: Implicit type conversion check
Hello,
I am sorry if it is some usual request, but I could not find recent
information about that, neither in the mailing list nor in the FAQ.
Is there any plan to enforce warnings about implicit type conversion ?
the -W option implies some checks about _comparison_ between signed
and unsigned, but nothing seems available for _affectation_.
In the snippet below, only line 9 can trigger a warning.
1 void function(float f, double d, int i, unsigned int u)
2 {
3 f = d; /* potential loss of information */
4 i = f; /* ~ */
5 i = d; /* ~ */
6 u = i; /* may overflow */
7 i = u; /* may overflow */
8
9 i = (i<u) ? u : i; /* this comparison *does* trigger a
warning */
10 }
Regards,
Pierre Chatelier