4 ms·
"Call me paranoid but finding '/*' inside this comment makes me suspicious" That, Sir, is none of your business.
by 13of40 3y ago
"Call me paranoid but finding '/*' inside this comment makes me suspicious"
That, Sir, is none of your business.
- Wowfunhappy 3y ago...I kind of wish compilers supported nested block comments. So if there's a /* inside of a /*, it would take two */'s to end it. Idk, maybe that would be a terrible idea in practice. But there are lots of instances where it would have saved me time.
- duskwuff 3y agoYou're probably looking for "#if 0" / "#endif".
- TillE 3y agoYeah it took me a while to adopt this common practice when I need to "comment out" a large block of code. Just use the preprocessor, it's much simpler.
- Karellen 3y agoFWIW, replacing comments with whitespace is also done by the preprocessor.
- billforsternz 3y agoThe fact that you can't do this with new fangled languages is one of the reasons I don't use new fangled languages
- zzo38computer 3y agoThat and other things I dislike about many of the new fangled languages.
- LoganDark 3y agoI prefer using completely unfangled languages, thank you very much.
- kevincox 3y agothe D Language supports /+ and +/ as a variant of /* which supports nesting. So you can pick which you need for a given comment.
- pjmlp 3y agoAlready an option on Borland compilers for MS-DOS.
- arcanemachiner 3y agoHow about explicit depth levels, specified by asterisk count? e.g. '/*' and '*/' would match each other, '/**' and '**/' would match, and so on. That way, you would have full control of the depth of the comments, removing other comments wouldn't break the inner comments, etc. I do run into the same issue you're describing, so I think there's value in the idea.
- deleted 3y ago[deleted]
- LoganDark 3y agoLike Lua, where comments can be delimited by `--[==[`..`]==]`, where the number of equals signs can be anything but has to match in order for the comment to actually close?
- Wowfunhappy 3y agoThe core idea here is that when I'm commenting out a block of code for testing, I don't really want to think about what is inside of it. So while I think this might help, I'd rather just have /* with one asterisk nest. What I'm not sure of is whether there's an edge case I haven't thought of which would make this problematic.
- legobmw99 3y agoI believe OCaml does this
- RGBCube 3y agoFYI, Rust and many other modern languages do this.
- crazygringo 3y agoNot terrible at all. It's super-useful to temporarily comment out a bit of code, and then to comment out a larger block surrounding it. Especially when debugging. Sadly I've never used a language that supported that.
- wavemode 3y agoCommon Lisp has nested comments with the #| reader macro. https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node191.html https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node191.html
- deleted 3y ago[deleted]