ztamas added a comment.

In https://reviews.llvm.org/D53974#1284000, @JonasToth wrote:

> For general understanding: Couldn't this check be generalized to comparing 
> integers of different sizes? We tried a 'dont-mix-int-types' check for 
> arithmetic already, its complicated :)
>  But this as a specialization of the category could be done easier (i think).
>
> What do you think?


I don't think so. This comparison is suspicious only inside a loop, not in 
general.
For example see this code:

  long size = 300000;
  short index = 100;
  
  if(index < size) {
   // ....
  }

You can choose the two values as you want, this comparison will work correctly.
However in a loop condition this comparison means a problem, because the loop 
stops only if the "index" variable gets bigger than the "size" variable.
So the loop context is important here.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to