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