Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
November 14, 2010 [Issue 5216] New: /+ parsed incorrectly in comments | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5216 Summary: /+ parsed incorrectly in comments Product: D Version: unspecified Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: jmdavisProg@gmx.com --- Comment #0 from Jonathan M Davis <jmdavisProg@gmx.com> 2010-11-14 04:04:26 PST --- This fails to compile void main() { /+ // /+ +/ } giving this error test.d(7): unterminated /+ +/ comment test.d(7): found 'EOF' when expecting '}' following compound statement It seems to be fine if it's not within a /+ +/ block, but once it is, the // comment is ignored, and since /+ is intended for commenting out code rather than just comments, this is not good behavior. All /+ and +/ should be ignored on lines where they are after //. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 17, 2010 [Issue 5216] /+ parsed incorrectly in comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=5216 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |INVALID --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2010-11-16 16:53:36 PST --- Commenting out code should properly be done using: version (none) { } The only thing the /+ comments recognize are +/ and /+. They are working as designed. They are not intended to recognize tokens or other comments. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 17, 2010 [Issue 5216] /+ parsed incorrectly in comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=5216 --- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2010-11-16 17:24:07 PST --- I could have sworn that the online docs said that one of the main reasons for /+ +/ was to comment out code, but regardless, it's not like you usually run into /+ or +/ inside of comments instead of delimiting them. I only ran into it because I was working on the D lexer for Phobos and one of the comments had them in it. The main issue is that they work as designed, so if this was as intended, then that's fine. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 17, 2010 [Issue 5216] /+ parsed incorrectly in comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=5216 nfxjfg@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |nfxjfg@gmail.com Resolution|INVALID | Severity|normal |enhancement --- Comment #3 from nfxjfg@gmail.com 2010-11-16 19:08:20 PST --- (In reply to comment #1) > Commenting out code should properly be done using: > > version (none) > { > } > > The only thing the /+ comments recognize are +/ and /+. They are working as designed. They are not intended to recognize tokens or other comments. That's unintuitive and error prone. Also you can't stick version anywhere. Obviously the design should be fixed. Reopening as enhancement request. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 17, 2010 [Issue 5216] /+ parsed incorrectly in comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=5216 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #4 from bearophile_hugs@eml.cc 2010-11-16 19:46:48 PST --- (In reply to comment #3) > (In reply to comment #1) > > Commenting out code should properly be done using: > > > > version (none) > > { > > } > > > > The only thing the /+ comments recognize are +/ and /+. They are working as designed. They are not intended to recognize tokens or other comments. > > That's unintuitive and error prone. Also you can't stick version anywhere. Obviously the design should be fixed. > > Reopening as enhancement request. Be more gentle. The current behaviour is not obviously bad. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 17, 2010 [Issue 5216] /+ parsed incorrectly in comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=5216 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |WONTFIX --- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2010-11-17 01:08:25 PST --- >That's unintuitive and error prone. I presume you mean the version(none). Unusual, yes. Unintuitive? How so? It's documented. Error prone? I don't see how - there's no way to set "none" as a version identifier. >Also you can't stick version anywhere. It's not necessary to stick it anywhere. It works fine for large blocks of code. For parts of an expression, /* */ works fine. It's hard to see an issue about this. >Obviously the design should be fixed. I don't think it's obvious wrong at all. It follows a simple rule, which I believe is better than having an arbitrarily complex rule with hard to remember special cases. Furthermore, if you do make a mistake with the /+ +/ nesting, you get an inevitable compiler error message. And lastly, the current behavior has existed for 10 years and this is the first anyone has complained about it. Changing it would arbitrarily break existing code and hence annoy people for a rather dubious benefit. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation