views:

343

answers:

10

Does your editor/ide highlight that a++; in this 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);
A: 

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

Sergey Dymchenko
+1  A: 

Yes, TextMate does it.

kaile
+2  A: 

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

sean e
Haha, VS beats emacs :)
Lucas
+1  A: 

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

// hello folks \
int a = 0;

// hello folks ??/
int a = 0;
Johannes Schaub - litb
+2  A: 

Slickedit - yes

KDevelop - yes

QT Creator - No

CodeBlocks - No

Duck
+2  A: 

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

Andrew
The install of vim I have (7.2, Ubuntu 10.04) sees the first one correctly, but misses on the trigraph.
Caleb Huitt - cjhuitt
A: 

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

Potatoswatter
+1  A: 

emacs 22.3.1: No to both, sadly

Adam Rosenfield
The same for my Emacs 23.1.1Should we file a bug report?
Sergey Dymchenko
Yes. Please do.
cschol
<flamebait>That's why you have to switch to vim</flamebait>
qrdl
A: 

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

chpwn
A: 

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;
gary comtois