This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]