Author |
Topic |
|
cnn
New Member
2 Posts |
Posted - Mar 23 2007 : 3:59:12 PM
|
I use the simplified chinese visual studio.net 2003 sp1 on windows server 2003 operation system. I have try install sereveal trial version visual assist X such as 10.2.1440,10.2.1445,10.3.1538 and the latest gerneal release 10.3.1544, and find that all of them have the same worng on coloring macros, see the code below //demo.cpp #include <stdio.h>
#define N 100 #define Kt 37
int main() { //.....some code }
in such a simple cpp file, coloring macros regrettably can not work well, the color of Kt has its rigth color but N do not.
I do not know whether it may caused by the version of IDE or the operation system. Before doing this, i have already added the key "identifer"="-?+?+?-?-+++" to the regedit.
I want to get the answer as soon as possible. Thank you.
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Mar 24 2007 : 3:58:20 PM
|
I am seeing the same effect here.
case=5661
Can you use longer names for your #defines? Single letter names are not very informative. |
zen is the art of being at one with the two'ness |
|
|
cnn
New Member
2 Posts |
Posted - Mar 25 2007 : 07:31:54 AM
|
Now i find that the VA version 10.0.1320 can work very well, i think this may be a small bug of the latter version. But it is vexatious that this version can not work on visual studio.net 2003 sp1, I try it on vc6.0 sp6. |
|
|
sl@sh
Tomato Guru
Switzerland
204 Posts |
Posted - Mar 26 2007 : 04:52:28 AM
|
I dimly remember a similar case on this forum. I thought the effect was related to Macros shorter than 3 letters, so I wonder why "Kt" actually works!?
And yes, using longer identifiers would definitely be a good idea, not only to give them a meaning but also to keep the preprocessor from inadvertantly replacing bits of code that really weren't meant to be replaced! Just to give a bad example: MS windows include files contain macros named "min" and "max". Unfortunately they apply to for instance the STL methods std::valarray::min() and std::valarray::max(), causing hard to locate compiler errors.
So: unless you're working on your own, not using anything else but MS libraries and includes, you are bound to run into problems if you don't take extra care with your prepocessor symbols!
(Of course, using const instead of #define would be even better, but that would be for another forum to discuss ) |
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Mar 26 2007 : 07:48:53 AM
|
quote: Originally posted by cnn
Now i find that the VA version 10.0.1320 can work very well, i think this may be a small bug of the latter version. But it is vexatious that this version can not work on visual studio.net 2003 sp1, I try it on vc6.0 sp6.
Using VA 1301 "N" is shown in blue (as a class, type) and in italic, as a stable symbol, so it is not working correctly for me in this version.
From a code point of view, I agree with sl@sh, who makes a very good case for using longer names, and perhaps avoiding #define entirely for this sort of thing. |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|
|
|