Author Topic: Grey out inactive preprocessor-code.  (Read 5776 times)

Offline Volatile Pulse

  • Single posting newcomer
  • *
  • Posts: 3
Grey out inactive preprocessor-code.
« on: July 12, 2012, 09:03:35 pm »
Hey guys, I'm new to the boards, but have been using C::B for a while now. I've gone from 10.05 to the new nightly 8081 (yes I know a newer one 8084 just came out). I have been tinkering with different features in the IDE and I absolutely love the options. One thing I've been running across was the inactive prepocessor code option. I typically leave it unchecked since I have yet to see it actually work. I have a quick program to demonstrate what I feel should work by default.

Code: [Select]
#include <iostream>

#ifdef _WIN32

int main() {
   std::cout << "Hello World!";

   return 0;
}

#endif

Now this program works 100% as intended, but in code blocks, there is no longer syntax highlighting. Not only can I not get an OS macro to work, but it seems the only macros I can get to work are ones I just define by myself.
Code: [Select]
#define myMacro
#if myMacro
//....
#endif

I feel this really defeats the purpose of this option as a whole since an inactive macro would technically be a macro that is invalid or just isn't used correctly. I feel there are more exceptions to this than actual uses of it. Is there a better alternative other than just leaving it unchecked? I'd eventually like something that would highlight the code that is relevant to my OS that I'm working on. I feel that would be one of the most used cases of the highlighting. Other things would include any compiler specific macros.

I know it's a lot to ask for, and I'm hoping something is in the works already, but I feel the option isn't really nessecary since I have yet to see a need for it.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Grey out inactive preprocessor-code.
« Reply #1 on: July 12, 2012, 09:17:33 pm »
There has been a similar question not long ago:
http://forums.codeblocks.org/index.php/topic,16576.msg112529.html

Next time please search the forum, before you ask a question.
Not searching the forum (and the web) violates our forum rules:
This post is here to assist you in your Code::Blocks / C++ blues, by telling you what NOT to do. This is not to frighten you, but unfortunately we have to be that strict due to continuous mis-use and dis-respect.
[...]
4. Search before you post.
[...]
Finale note: Ignoring these rules may result in the topic being (silently) locked and/or even removed completely without any notice.

In case you wonder why we are so strict: I could say: "Search the forum" - as this has been discussed a lot. To make is short: By law we (the devs/moderators) are responsible for the content of our forum. This means we need to read all posts. If you want us to continue the development of C::B and have the time to answer some of the questions that are really related to C::B, apply the rules above. It's obviously a matter of time for us.

More general help how to use our forum you'll find here, too.

Offline Volatile Pulse

  • Single posting newcomer
  • *
  • Posts: 3
Re: Grey out inactive preprocessor-code.
« Reply #2 on: July 12, 2012, 09:41:50 pm »
I actually found that one when I googled my question. I was unable to find it using the search feature on the forum though. I was more curious about the reason as to why it was added in. Is there going to be further implementation of it? Also, when does it come in handy other than implicitly defining macros? Is it that big of a request that it was thrown in?