Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsC/C++ CodeReview IRuleFilter
https://www.eclipse.org/forums/index.php/mv/msg/28515/92553/#msg_92553
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?]]>wangjinhui2007-02-15T09:06:23-00:00Re: C/C++ CodeReview IRuleFilter
https://www.eclipse.org/forums/index.php/mv/msg/28515/92648/#msg_92648
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?
>
>]]>2007-02-16T16:30:36-00:00