tag:blogger.com,1999:blog-6945177.post2731888695944375482..comments2024-02-06T14:15:57.712+05:30Comments on Thoughts of a Thinking Craftsman: Writing a Code Duplication DetectorNitin Bhidehttp://www.blogger.com/profile/00559300191011023611noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-6945177.post-76617115172982056752011-08-23T18:25:27.905+05:302011-08-23T18:25:27.905+05:30Yogesh,
AST/ASG can definitely be used for detecti...Yogesh,<br />AST/ASG can definitely be used for detecting duplicates. But, it is far more challenging to hack on the compiler. <br /><br />A standalone tool which works on text files (source code) has its advantages and disadvantages. It is simpler to make it work on multiple languages. However it may not be able to detect some deep rooted duplicates that AST/ASG approach will be able to detect.Nitin Bhidehttps://www.blogger.com/profile/00559300191011023611noreply@blogger.comtag:blogger.com,1999:blog-6945177.post-35587774033370906472011-08-23T09:33:34.856+05:302011-08-23T09:33:34.856+05:30I think that AST/ASG can also be used for detectin...I think that AST/ASG can also be used for detecting duplicate. It will be interesting to see how we can use it. It might be more useful to hack into compilers (such as gccxml) and produce different statistics.Yogeshhttps://www.blogger.com/profile/06545641404327852706noreply@blogger.comtag:blogger.com,1999:blog-6945177.post-7709667563906206142010-01-26T19:45:41.183+05:302010-01-26T19:45:41.183+05:30Thanks. I will look at the bug reports.
about ca...Thanks. I will look at the bug reports. <br /><br />about catching same code structure but different variable names, I tried initial but could not find a good way at that time. Will give a one more try.Nitin Bhidehttps://www.blogger.com/profile/00559300191011023611noreply@blogger.comtag:blogger.com,1999:blog-6945177.post-10294402920730067152010-01-24T13:39:43.267+05:302010-01-24T13:39:43.267+05:30Tried this today. Thanks - nice tool! I filed a fe...Tried this today. Thanks - nice tool! I filed a few reports on the code.google project site and hope you can make the changes.<br /><br />I wonder if it would be worth to cannonicalize the variables and literals in the snippets to get more hits. I mean if there is strcpy(str1, str2); and strcpy(str1, test); that is not a duplicate. But if you replace all vars by v1,v2,v3.... then if could catch Stefan Sauerhttps://www.blogger.com/profile/07581829597044799690noreply@blogger.com