[cfe-commits] [Review Request]Polymorphic Pointers Checker

Jim Goodnow II Jim at TheGoodnows.net
Fri May 20 16:34:43 PDT 2011


Well, you could ask that about any static analysis checker, but in this 
case, it is detecting a particular situation that is prone to errors, 
but is not itself an actual error. The intent is to have a set of C++ 
checks that give warnings about potentially problematic code. While 
these two are fairly simple, others will be more involved. I'm just 
trying to increase the amount of checking that is C++ specific. Adding 
these two doubles the number of C++ specific checkers.

  - jim

On 5/20/2011 4:11 PM, Argyrios Kyrtzidis wrote:
> Why is this an analyzer checker and not a compiler warning ? Same question applies to "C++ C Style Cast Checker".
>
> On May 20, 2011, at 3:43 PM, Jim Goodnow II wrote:
>
>> This checks for the implicit casting of an array of a derived type to a base pointer. This is problematic because if the base pointer is incremented or indexed, a size difference between the base and derived classes could result in a bad pointer calculation. I could check for the sizes of the two classes to see if they happen to be the same, but it's really just a bad practice, since the size could change on a later revision.
>>
>>   - jim
>>
>>
>> <polymorphicpointer.cpp><PolymorphicPointer.patch><PolymorphicPointerChecker.cpp>_______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>



More information about the cfe-commits mailing list