public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Implicit conversion from 32bits integer to 16bits integer (GCC   4.3.3)
       [not found] <21fb03090903100718p5124233cn59452c54477fb1a1@mail.gmail.com>
@ 2009-03-10 14:36 ` Manuel López-Ibáñez
  0 siblings, 0 replies; only message in thread
From: Manuel López-Ibáñez @ 2009-03-10 14:36 UTC (permalink / raw)
  To: Frederic Belouin; +Cc: gcc-help

2009/3/10 Frederic Belouin <frederic.belouin@gmail.com>:
> Hello,
>
> I would like to have a warning when there is an Implicit conversion in
> source code:

This is a question for gcc-help.

> 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,

It should not. Does it really? Can you provide a complete preprocessed testcase?

> but it also display warning for function implicit conversion:
> Is it possible to have only warning for implicit conversion for
> variable and not for prototype?

You did not understand what -Wtraditional-conversion does:

http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

-Wtraditional-conversion (C and Objective-C only)
Warn if a prototype causes a type conversion that is different from
what would happen to the same argument in the absence of a prototype.

It means that, if there was no prototype for foobar, there would be a
type conversion different from what occurs given the prototype, and
that is what Wtraditional-conversion warns.

What you want is -Wconversion. http://gcc.gnu.org/wiki/NewWconversion

Cheers,

Manuel.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-10 14:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <21fb03090903100718p5124233cn59452c54477fb1a1@mail.gmail.com>
2009-03-10 14:36 ` Implicit conversion from 32bits integer to 16bits integer (GCC 4.3.3) Manuel López-Ibáñez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).