MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/8iffw2/java_executing_code_in_comments/dysix88/?context=3
r/programming • u/javinpaul • May 10 '18
84 comments sorted by
View all comments
3
Quick question. Would this work in C/C++? If I recall correctly, the CPP (C preprocessor) strips the comments from the file/code being executed.
5 u/scorcher24 May 10 '18 https://stackoverflow.com/questions/30996145/is-executing-c-code-in-comments-with-certain-unicode-characters-allowed-like 2 u/sleepsort May 10 '18 Thanks! Was going to test this out as soon as I got home but that adds a lot of explanation! 5 u/Drisku11 May 11 '18 You can do the opposite with C/C++ (pre-C++17) though: surprise coworkers by turning non-comment lines into comments with trigraphs.
5
https://stackoverflow.com/questions/30996145/is-executing-c-code-in-comments-with-certain-unicode-characters-allowed-like
2 u/sleepsort May 10 '18 Thanks! Was going to test this out as soon as I got home but that adds a lot of explanation! 5 u/Drisku11 May 11 '18 You can do the opposite with C/C++ (pre-C++17) though: surprise coworkers by turning non-comment lines into comments with trigraphs.
2
Thanks! Was going to test this out as soon as I got home but that adds a lot of explanation!
5 u/Drisku11 May 11 '18 You can do the opposite with C/C++ (pre-C++17) though: surprise coworkers by turning non-comment lines into comments with trigraphs.
You can do the opposite with C/C++ (pre-C++17) though: surprise coworkers by turning non-comment lines into comments with trigraphs.
3
u/sleepsort May 10 '18
Quick question. Would this work in C/C++? If I recall correctly, the CPP (C preprocessor) strips the comments from the file/code being executed.