I know this question was asked earlier (for example, see Remove comments from C / C ++ code ), but I did not find a satisfactory result.
I am analyzing a set of complex C / C ++ code that must first be normalized, including removing comments from the input source code.
All of the decomposition tools I tried to a certain extent failed, and this includes:
- decomposition
- stripcmt
- Cloc
Note: I also tried "gcc -fpreprocessed -E", but this does not produce the perfect result; the output contains some weird macro annotations for tracking specific lines of code.
To illustrate the problem with a particular tool (cloc), deleting comments from this header file also removes non-comments, such as all inclusions at the beginning of this file.
However, is there a reliable comment removal tool that can be used to remove comments in extremely complex code?
Very grateful.
source share