Sublime Forum

#if defined and #endif coloring problem in C

#1

Hello folks,

The 2181 build seems to have a problem with coloring preprocessor statements. In the following snippet the words marked red are not colored correctly:

#if defined (BEOS)

ifdef ZLIB_DLL

ifdef ZLIB_INTERNAL

define ZEXPORT __declspec(dllexport)

define ZEXPORTVA __declspec(dllexport)

else

define ZEXPORT __declspec(dllimport)

define ZEXPORTVA __declspec(dllimport)

endif

endif

#endif

Thanks,

Akos

0 Likes

#2

I code in C++ all day, so this was a problem for me as well. I created my own copy of the C++ language and fixed it here github.com/facelessuser/sublime … tter%20C++

This will probably fix your issue. But this should also get fixed on the official one as well.

0 Likes

#3

Thanks, I’ll give it a try.

Yes, it fixes the embedded endif, but doesn’t fix the first defined.

Best, Akos

0 Likes

#4

[quote=“asomorjai”]Thanks, I’ll give it a try.

Yes, it fixes the embedded endif, but doesn’t fix the first defined.

Best, Akos[/quote]

I should say in my color scheme red is the same as #if and green is for the macro function.

Ahh, that is where we are at a difference of opinion. What are you expecting defined to be highlighted as, green? red? According to the rules, it is getting highlighted, or not not highlighted as expected. If you are expected green, I think that would be way wrong. I could see red, since it is a preprocessor directive. There just ins’t a rule for it, but one could be added though.

You see, the #define macro() gets highlighted green because you are defining a macro. With #if, you are not highlighting a macro; defined() it is not a macro.

0 Likes

#5

[quote=“facelessuser”]I code in C++ all day, so this was a problem for me as well. I created my own copy of the C++ language and fixed it here github.com/facelessuser/sublime … tter%20C++

This will probably fix your issue. But this should also get fixed on the official one as well.[/quote]

Thanks, I’ll give it a try.

Best, Akos

0 Likes