This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: No Compilation Warning...
- From: "Manje Gowda S G" <sakala at linuxmail dot org>
- To: "Jim Wilson" <wilson at specifixinc dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 05 Jul 2004 21:29:56 +0800
- Subject: Re: No Compilation Warning...
> Manje Gowda S G wrote:
> > 1) There is some fundamental reason behind this, I am not aware..., any light on this is greatly appreciated.
>
> The real reason for this is probably "an accident of history".
>
> However, K&R C and ISO C have different rules for promoting types when
> you mix types with different sizes and different signedness. Thus it
> makes some sense to emit warnings by default in this case, as this will
> help catch problems in code that may have been written for a different
> version of the C language. It makes no difference for this specific
> example, but in general it may make a difference.
>
> There is also the problem that it is easy to type a number that is too
> large for a small type, like short, but that can't happen for int, as
> then you would have a parse error. So it makes more sense to have range
> checks for types smaller than int than it does to have them for int.
>
> > 2) STILL...,
> > unsigned int s;
> > if (0 <= s) {....}
>
> If you use -Wextra, you will get a warning. See the documentation.
> This is a different warning message than the one you get for shorts.
> --
Thank you for the response, as you told it is "an accident of history". I have check it in TC compiler where in warning is showed.
since in general it makes a difference, I think it is better to fix this at least on optimization flag is enabled.
Best Regards,
-Manje Gowda
--
______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org
This allows you to send and receive SMS through your mailbox.
Powered by Outblaze