------- Additional Comments From bangerth at dealii dot org  2005-08-29 23:10 
-------
What Andrew is trying to say is that in C, even variables that are marked  
'const' can be modified. Thus, the compiler can't (naively, i.e. without  
using flow analysis) determine that 'i' or 'ic' have the value 5, and  
therefore warn that there is a comparison between signed and unsigned.  
However, in the last line, the compiler knows the value that is being   
compared to 5u and sees that nothing bad can happen here. It therefore  
does not warn.  
 
In C++, the situation is different, since const variables can't be changed. 
The compiler could therefore be able to determine that the second comparison 
does not warrant a warning. This notwithstanding, the compiler doesn't do  
this right now. 
 
As annoying as this is, I don't consider this a bug. It may be classified 
as an enhancement, though, if someone wants to make this warning contigent 
upon the availability of forward propagation of values. General consensus 
has been, however, not to do this. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Priority|P2                          |P3
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-29 23:10:37
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23608

Reply via email to