How can I automatically replace all C style comments (/* comment */
) by C++ style comments (// comment
)?
This has to be done automatically in several files. Any solution is okay, as long as it works.
This tool does the job: https://github.com/cenit/jburkardt/tree/master/recomment
RECOMMENT is a C++ program which converts C style comments to C++ style comments.
It also handles all the non-trivial cases mentioned by other people:
This code incorporates suggestions and coding provided on 28 April 2005 by Steven Martin of JDS Uniphase, Melbourne Florida. These suggestions allow the program to ignore the internal contents of strings, (which might otherwise seem to begin or end comments), to handle lines of code with trailing comments, and to handle comments with trailing bits of code.