Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » C/C++ CodeReview IRuleFilter
C/C++ CodeReview IRuleFilter [message #92553] Thu, 15 February 2007 09:06 Go to next message
wangjinhui is currently offline wangjinhuiFriend
Messages: 24
Registered: July 2009
Junior Member
I am working with TPTP static analyze for C/C++. I found the following code
for finding the desturctor definition for a C++ class:

private static IRuleFilter[] destructorFunct = {
new ASTNodeTypeRuleFilter(IASTNodeTypes.ICPPASTFunctionDefinitio n, true),
new DestructorFunctionDefinitionRuleFilter(true)
};

My question is that why not make the destructorFunct like this:

private static IRuleFilter destructorFunct = new
DestructorFunctionDefinitionRuleFilter(true);

Why bother to add the ICPPASTFunctionDefinition into the filter? Is this for
effeciency or something else?
Re: C/C++ CodeReview IRuleFilter [message #92648 is a reply to message #92553] Fri, 16 February 2007 16:30 Go to previous message
Eclipse UserFriend
Originally posted by: s_gutz.ca.ibm.com

It's certainly not for efficiency since single filter would always be
faster. Without really digging into the code I'm not sure this approach
was used. I didn't write this rule but my guess is that the first
filter is ensuring that this is a C++ function definition in case
someone runs this rule on C code and hits a method that looks remarkably
like a destructor (as unlikely as that is).

Steve


Tim Wang wrote:
> I am working with TPTP static analyze for C/C++. I found the following code
> for finding the desturctor definition for a C++ class:
>
> private static IRuleFilter[] destructorFunct = {
> new ASTNodeTypeRuleFilter(IASTNodeTypes.ICPPASTFunctionDefinitio n, true),
> new DestructorFunctionDefinitionRuleFilter(true)
> };
>
> My question is that why not make the destructorFunct like this:
>
> private static IRuleFilter destructorFunct = new
> DestructorFunctionDefinitionRuleFilter(true);
>
> Why bother to add the ICPPASTFunctionDefinition into the filter? Is this for
> effeciency or something else?
>
>
Previous Topic:java applets and performance testing
Next Topic:deleting /tmp/IBMRAC doesn't solve the IWAT0284E problem (No AgentController)
Goto Forum:
  


Current Time: Sat Aug 08 16:03:59 GMT 2020

Powered by FUDForum. Page generated in 0.01998 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top