This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Implicit conversion from 32bits integer to 16bits integer (GCC 4.3.3)
- From: Frederic Belouin <frederic dot belouin at gmail dot com>
- To: gcc at gnu dot org
- Date: Tue, 10 Mar 2009 15:18:28 +0100
- Subject: Implicit conversion from 32bits integer to 16bits integer (GCC 4.3.3)
Hello,
I would like to have a warning when there is an Implicit conversion in
source code:
uint32_t foo = 2000;
uint16_t bar = foo;? //--> Warning Implicit conversion from uint32_t
to uint16_t....
uint16_t bar2= (uint16_t) foo; // --> no warning.
I now that -Wtraditional-conversion in GCC 4.3.x is able to show this
message, but it also display warning for function implicit conversion:
extern void foobar(uint16_t x);
int main()
{
? uint16_t a = 32;
? foobar(a); // --> Warning: implicit conversion in parameter foobar parameter 1
}
Is it possible to have only warning for implicit conversion for
variable and not for prototype?
Best Regards
Frederic