Author Topic: can find #endif in defs list for C language  (Read 5314 times)

chgmxx

  • Community Member
  • Posts: 10
  • Hero Points: 0
can find #endif in defs list for C language
« on: June 10, 2015, 02:32:47 AM »
Hi all
I love slickedit very much. but now I found that in the defs list ,I can find #endif keyword .
How can i config it? please look in the attachment

Thanks
chen

Dennis

  • Senior Community Member
  • Posts: 3998
  • Hero Points: 521
Re: can find #endif in defs list for C language
« Reply #1 on: June 10, 2015, 05:49:26 PM »
The Defs tool window doesn't show the #endif, because it is considered to be part of the #ifdef, #ifndef, #if or #elif statement that introduced the block.

Take the following for example:
Code: [Select]
#ifdef XXXXX

   void haveXXXX();

#elif YYYYY

   void haveYYYYY();

#elif ZZZZZ

   void haveZZZZZ();

#endif

When you turn on Statement Tagging in the Defs tool window, you will see each of the preprocessing statements, excluding the "#endif", just like we would not show the close brace for a while or for statement.

BTW, you can use the block matching to jump from a the start of a preprocessing block statement to the corresponding #endif.  (Search > Go to Matching Parenthesis).
« Last Edit: June 10, 2015, 05:51:54 PM by Dennis »

chgmxx

  • Community Member
  • Posts: 10
  • Hero Points: 0
Re: can find #endif in defs list for C language
« Reply #2 on: June 11, 2015, 03:21:30 AM »
Hi Dennis

Thanks a lot for your reply.
But I think that we need this feature. So, is there any macro script be avaiable. it's a little unconvient to find the corresponding #endif

Thanks
Chen

hs2

  • Senior Community Member
  • Posts: 2762
  • Hero Points: 292
Re: can find #endif in defs list for C language
« Reply #3 on: June 11, 2015, 04:49:26 AM »
@chgmxx: It's not too bad that it's a little bit inconvenient b/c this reminds one that #ifdef and preprocessor magic in general is evil and should be avoided ;D
Unfortunately it's sometimes the best solution..
BTW: I've bound the very helpful 'find-matching-paren' command to a hotkey.
HS2
« Last Edit: June 11, 2015, 04:53:59 AM by hs2 »

Dennis

  • Senior Community Member
  • Posts: 3998
  • Hero Points: 521
Re: can find #endif in defs list for C language
« Reply #4 on: June 11, 2015, 04:38:55 PM »
Also notice that in the Defs tool window, the code that is within the #if... #endif sequence is nested under the tree structure, so just look for sibling of the #if statement, and that will be the next symbol after the #endif.

JimmieC

  • Senior Community Member
  • Posts: 506
  • Hero Points: 17
Re: can find #endif in defs list for C language
« Reply #5 on: June 11, 2015, 04:52:37 PM »
Yeah, the #endif is implicit from the nesting. Some may prefer display of the #endif for sense of completeness in the tool window but the tree nesting does indicate it's placement.

Jim

chgmxx

  • Community Member
  • Posts: 10
  • Hero Points: 0
Re: can find #endif in defs list for C language
« Reply #6 on: June 13, 2015, 07:20:07 AM »
Also notice that in the Defs tool window, the code that is within the #if... #endif sequence is nested under the tree structure, so just look for sibling of the #if statement, and that will be the next symbol after the #endif.
Hi Dennis&hs2
Thanks a lot for your reply.
Maybe this feature is quite a little programmer need it. but I used to using source insight tool. the #if ..#endif layout in defs is quite useful for us to understand the bound of source code.

Thanks again.
Chen