r/programming • • May 10 '18

Java: Executing code in comments?!

http://programming.guide/java/executing-code-in-comments.html
260 Upvotes

84 comments sorted by

View all comments

Show parent comments

0

u/DynamicTextureModify May 11 '18

That's ridiculous. Brain damage is right.

I don't care if it's a "pre-pass" or not, commented lines should always be ignored.1


  1. Don't get me started on nonsense like those PHP interpreting engines that use fucking docblocks programmatically for database definitions and shit. I almost had an anyuerism when I started reading about that.

-2

u/recursive May 11 '18

That's how it already works. What you probably object to is how java defines "lines".

1

u/DynamicTextureModify May 12 '18

// \u000d System.out.println("Hello World!"); Is a line. It only becomes 2 lines after Java parses the unicode in this line. The fact that it reaches the point where it could be considered 2 lines is the problem in the first place.

1

u/recursive May 12 '18

I think we're all in agreement on that.