开发者

Backslash in the end of comment lines in C/C++

Does your editor/ide highlight that a++; in thi开发者_JAVA百科s C/C++ code as part of a comment?

int a=1;
//some comment \
a++;
printf("%d\n",a);

And what about this?

int a=1;
//some comment ??/
a++;
printf("%d\n",a);


VC6, Visual Studio 2003, 2005, 2008, 2010 all do.


Slickedit - yes

KDevelop - yes

QT Creator - No

CodeBlocks - No


vim 7.2 sees it as a comment, and gcc 3.4.3 compiles it as a comment.


emacs 22.3.1: No to both, sadly


Yes, TextMate does it.


Kate (3.4) only highlights the first test, fails hilighting the second test

// hello folks \
int a = 0;

// hello folks ??/
int a = 0;


From http://forums.topcoder.com/?module=Thread&threadID=666932

Quick note on which popular editors show this as a comment : vim - yes emacs - no :) kate - no gedit - yes netbeans - yes kwrite - yes


XCode and CodeWarrior handle it properly. (But not the trigraph, lol.)


Xcode sees the first as a comment, the second not.


Good question! I was going to ask a question about this until I found this one.

The Visual-DSP++ IDE from Analog Devices does not highlight either comment when writing in assembly or C. For example:

r1 = dm(pPointer1);      // Store pointer to r0\
r0 = lshift r1 by -16;   // Not highlighted as a comment but DOES NOT EXECUTE.
dm(i0,m1) = r0;
dm(i0,m1) = r1;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜