[PATCH] D16310: new clang-tidy checker misc-long-cast

Richard via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 10 09:11:49 PST 2016


In article <CA180F4D0C023044AA10FB1BDCAC4D1F0704961B at EX01.evidente.local>,
    Daniel Marjamäki <Daniel.Marjamaki at evidente.se> writes:

> > You can get overflow with / and %. Consider:
> >
> > int i = INT_MIN / -1; // similar for %
> 
> you are right, I did not think of that. 
> 
> imho overflow still seems unlikely for / and %.

I thought the whole point was to flag instances where the presence
of a cast indicated a suspicion of intent that wasn't being satisfied?

In other words, overflow may be unlikely but doesn't the presence of
the cast indicate the same suspicious intent?
-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>


More information about the cfe-commits mailing list