Re:The One Character Block Comment
by dfranke on Tuesday July 21, 2009 @04:00PM
(#716772)
This is also an old trick to test whether your code was compiled as a C++ or not:
[ Parent
| on HN ]
This is fun and has some hack value but I hope nobody ever uses such a kludge in real code.
It totally fails with crappy C compilers that decide to feature C++ comments unannounced. IIRC gcc does this unless you give -ansi or -std=c89. And C99 officially supports the // -comments but hasn't got C++ features, of course.
Is there a situation where you would need this instead of "#ifdef __cplusplus"?
e.g. http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#...