Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Preprocessor macro color also applies to enums

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
karlhendrikse Posted - Jan 04 2012 : 12:29:17 AM
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
3   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Jan 06 2012 : 11:39:40 AM
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.)
kevinsikes Posted - Jan 06 2012 : 11:06:55 AM
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.
feline Posted - Jan 05 2012 : 11:51:03 PM
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.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000