-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Understand C++: Ignore comments #7
Comments
It seems that C gives you a surprising amount of flexibility in placing comments. e.g. /* comment */ # /* comment */ include /* comment */ <stdio.h> // comment |
It can be even worse... /*
comment */ # /* comment */ include /* comment */ <stdio.h> /* comment
*/ In the smart parser, I've been stripping comments from the beginning and ends of the lines, because they're usually irrelevant once the code is changed. Unfortunately, it's a little unclear what to do when they span multiple lines. I suspect I should leave them alone. Multi-line comments are probably less likely to be specific to the line I'm removing than single-line comments are. I've never actually seen this sort of code, but I could imagine it: /* Copyright <Year> <Author>
<License>
*/ #pragma once |
I should probably mention that the 'smart parser' was dropped in 3af39a7. Not sure if or when I'll work on it again. It would certainly handle a few more weird cases, like the horror above, but I would basically only find out if it was worth the (significant) effort after the fact. |
When searching through files, anything within comment blocks should be ignored as irrelevant.
The text was updated successfully, but these errors were encountered: