Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Preprocessor macro color also applies to enums
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

karlhendrikse
Starting Member

New Zealand
1 Posts

Posted - Jan 04 2012 :  12:29:17 AM  Show Profile  Reply with Quote
The color that I set for preprocessor macros also affects enum constants. These should be colored the same as normal identifiers; they have nothing to do with the preprocessor.

I have my preprocessor macros set to a terrible brown color, so I can tell when they're being used. Every time I see something that color it sets off alarm bells in my head. Now all my enum values are that color too, which is distressing.

For example, in the code below, SOME_MACRO and SomeConstant are always the same color when enahanced syntax coloring is enabled:

#ifdef SOME_MACRO
enum SomeEnum
{
  SomeConstant,
};
#endif


It would be nice if there was a separate setting for the color of enum member names, but an easier fix would be just to leave enums at their Visual Studio-specified color (or change the "Variables" color to be "Variables and enum constants" - they're kind of like static const ints).

Visual Studio 2010 Version 10.0.30319.1
Visual Assist X Version 10.6.1859.0

feline
Whole Tomato Software

United Kingdom
19074 Posts

Posted - Jan 05 2012 :  11:51:03 PM  Show Profile  Reply with Quote
Out of interest is there a reason why you want this? I appreciate that enum's and preprocessor declarations are different things, but sometimes they are used in a fairly similar way, both to convey a simple fixed value / number.

zen is the art of being at one with the two'ness
Go to Top of Page

kevinsikes
Tomato Guru

USA
271 Posts

Posted - Jan 06 2012 :  11:06:55 AM  Show Profile  Reply with Quote
Macros introduce the possibility of (nasty) side effects, so Karl wants to quickly spot where they are used. Enums do not pose the same risk. Karl wants to quickly spot where such side effects may be introduced in his code the code his coworker wrote.

Kevin Sikes
Infotainment Platform Design Engineer
Ford Motor Company
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 06 2012 :  11:39:40 AM  Show Profile  Reply with Quote
Basically, I like the idea of "change the "Variables" color to be "Variables and enum constants" - they're kind of like static const ints".
But, Feline is also right: "sometimes they are used in a fairly similar way, both to convey a simple fixed value / number."
Kevin's post also makes sense.

Personally, I always use UPPERCASE symbol names for defines (rarely use them though), and I see a lot of code when the same policy is applied. The define is also in UPPER_CASE in your example.
Ultimately, changing the coloring methodology may confuse existing users. Adding a new, different color is something that we usually trying to avoid to avoid to much color.

I would vote for the original idea (treating enums like constants) if a change was made. I think this is not an easy decision. Personally, I can live with the current coloring while defines are usually in UPPER_CASE, but I could also accept a change (e.g. enums like constants). The latter would be a more contemporary approach I guess. Some programmers tend to overuse defines, IMO (and do some weird stuff with them.)

Edited by - accord on Jan 06 2012 11:45:17 AM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000