+ 1

Nested multi-line comments are not supported

https://code.sololearn.com/cY2p4cPpiRVf/?ref=app

11th Oct 2019, 7:59 AM
UraL
12 ответов
+ 6
When compiler sees /* (outer block start) it is taken as block comment start, and when it sees */ (inner block end) it is taken as block comments end. So your */ (outer block end) isn't considered the outer block comment end. The compiler fails to process the */ (outer block end) so whatever comes after it is not possible to be processed.
11th Oct 2019, 8:30 AM
Ipang
+ 3
this seen to be sololearn compiler, let me try another online compiler
11th Oct 2019, 8:05 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 3
✳AsterisK✳ others don't work too:-)
11th Oct 2019, 8:09 AM
UraL
+ 3
yeah i just noticed that too UraL
11th Oct 2019, 8:12 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 3
the compiler read this line by line and after /* it meets / which will give an error
11th Oct 2019, 8:14 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 3
Nested multiline comments are neither part of any standard nor useful so why should any compiler support them? Especially since supporting this might break older codes.
11th Oct 2019, 8:19 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 3
Aaron Eberhardt For example, I commented out the program code. Then I want to comment out another part of the code, which includes the already commented code
11th Oct 2019, 8:37 AM
UraL
+ 3
Ipang It would be possible to check the pairing / * - * / to implement. After all, nested blocks {} work
11th Oct 2019, 8:40 AM
UraL
+ 3
UraL I see your problem. But it's not that hard to simply replace your comment. Also it's not a good practice to comment things out like that. P.S. you can use if(false) { ... } as comment too if you really need it.
11th Oct 2019, 8:41 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 2
UraL That's just how the compiler was "taught", to ignore whatever between /* and */. If somehow there's a */ in between, it will take it as comment block end anyways. I'm still not sure how this way of commenting is comparable to nested {}, or even a use case : )
11th Oct 2019, 8:53 AM
Ipang
+ 2
You can nest // inside /* */
11th Oct 2019, 10:19 AM
Sonic
Sonic - avatar
+ 2
Sonic i know this
11th Oct 2019, 11:51 AM
UraL