Comments from "#if 0" to "#endif"

Comments from "#if 0" to "#endif"

3
NewbieNewbie
3

    Jul 12, 2005#1

    Hi everybody,

    I use Ultraedit as C code editor. In the code I use often the contruct "#if 0" and '#endif" to temporarily comment out blocks of code. I would like ultraedit to ink this in same color as commented blocks.
    I already tried to patch the wordfile.txt. I tried each of the following to add to the wordfile:

    Code: Select all

    Comment Block On Alt = "#if 0" Comment Block Off Alt = "#endif"

    Code: Select all

    Comment Block On Alt = #if 0 Comment Block Off Alt = #endif

    Code: Select all

    Comment Block On Alt = #if%200 Comment Block Off Alt = #endif

    Code: Select all

    Comment Block On Alt = #if\ 0 Comment Block Off Alt = #endif
    Nothing of that works.

    Does somebody knows, how to do this or what I did wrong?

    I think there may be a problem handling the white space character between "#if" and "0".

    6,686585
    Grand MasterGrand Master
    6,686585

      Jul 12, 2005#2

      Yes, the white space is the problem and there is no solution for it, isn't it.

      I also use often #if directive to comment some big code array. But I use

      #ifdef BCON
      code
      #ifdef Anything
      code
      #endif
      code
      #endif // BCOFF

      BCON means Block Comment On and is not defined!
      BCOFF means Block Comment Off

      These two words used as alternative block comment should comment it out, but I don't want to highlight it as comment. So I haven't tried it, if this really works.
      Best regards from an UC/UE/UES for Windows user from Austria

      3
      NewbieNewbie
      3

        Jul 13, 2005#3

        Hi Mofi,

        thanks for your answer. This is really a good idea. And it works indeed. But curiously only if I declare BCON and BCOFF as not alternative block comments.

        But I am working in a company with many programmers and I don't think that I can educate all to use this new style.
        So this is why this procedure doesn't satisfy my fully.

        Is there mybe another way to solve this problem?

        6,686585
        Grand MasterGrand Master
        6,686585

          Jul 13, 2005#4

          I have now tested BCON and BCOFF and it works as alternative block comment. According to your first post I guess, you have defined it wrong.

          Correct is: Block Comment On Alt = BCON Block Comment Off Alt = BCOFF

          But it is unfortunately not possible to specify a block comment which includes a space. This is only available for line comments. You could write an email with a feature request to IDM for a "Block Comment Num=" feature. And an extension in max. length for the block comments strings must also be requested, because according to UE help only five characters are allowed (#endif has 6). Although I think, the length can already be longer and the help is not up-to-date.
          Best regards from an UC/UE/UES for Windows user from Austria

          3
          NewbieNewbie
          3

            Jul 14, 2005#5

            Okay, thanks for that answer. Now I know that the current version doesn't support white space inside a block comment string.
            Maybe I will make a feature request for that.

            Thanks everybody.