Author |
Topic |
|
Klaus
New Member
3 Posts |
Posted - May 21 2010 : 2:08:48 PM
|
I've experienced a syntax highlighting problem in a C++ project, which I've narrowed down to the following code:
test.h: enum Test { A, B, C };
test.cpp: #include "test.h" int main(int argc, char* argv[]) { switch (A) { case A: ; case B: case C: break; } return 0; }
If the enum is declared in a header file, and you have a semicolon somewhere after a case, then the previous enum value is not highlighted any more.
This wouldn't be much of a problem, but in my code this also happens with a macro directly after a case (if there is a semicolon after the macro or even part of the macro definition). I couldn't reproduce that in the example above, but I assume that if you fix this one, then the problem with the macros will also go away. :)
EDIT: Sorry, forgot some info: Version 10.6.1823.0, Build 2010.05.06, VS 2005
Thanks... |
Edited by - Klaus on May 21 2010 2:15:27 PM |
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - May 24 2010 : 12:15:41 PM
|
I am seeing the same effect here using VA1823 and VS2005 SP1, but also wondering why wasn't you able to reproduce this with the macro. Did you tried with your original macro or a simplified one?
I have put in a bug report for this:
case=44723 |
|
|
Klaus
New Member
3 Posts |
Posted - May 25 2010 : 05:25:59 AM
|
Hi, I've looked into the macro issue again: Macros work fine, unless there's a macro called ASSERT. Try these definitions before the switch:
#define ASSERT(n) printf(n) #define TEST(n) ASSERT(n) ... case A: TEST(0);
The issue occurs because of the name ASSERT. Rename it and the "A" will be highlighted. The issue also occurs if TEST(n) expands to nothing, which is equivalent to a single semicolon after the case. |
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - May 26 2010 : 04:03:34 AM
|
Thank you for taking the time to deal with this. I've added your findings to the case. |
|
|
|
Topic |
|
|
|