This is the mail archive of the 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]

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 @ 
This allows you to send and receive SMS through your mailbox.

Powered by Outblaze

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