Monday, November 23, 2009


More from the exotic C++ bugs department:
Under GCC, the \ character at the end of a single-line comment extends the comment to the next line.

A similar behavior is well-known and oft-used for the preprocessor directives (#define etc.), but for the comments? No such behavior under MSVC; the code in question was ported from Windows, where it worked like a charm. And the worst part is, the IDE (Apple Xcode in my case) did not know about that either - the second, commented out line was not colored as one.

You learn something new every day.

No comments:

Post a Comment