Author Topic: How can I get the final value of nested definition ?  (Read 4007 times)

yoonpyo hong

  • New Community Member
  • Posts: 1
  • Hero Points: 0
How can I get the final value of nested definition ?
« on: August 22, 2016, 02:20:21 PM »

I'd like to know the value of complex definition expression.

for example, some when I wrote some definition into c/c++ preprocessing,
#define _TEST_DEF_1  (1)
#define _TEST_DEF_2 (2)
#define _TEST_DEF_3 (_TEST_DEF_1 + _TEST_DEF_2)
#define _TEST_DEF_4 (_TEST_DEF_3*2)+(_TEST_DEF_2)

Then, Slick can inactivate the non-effective code automatically. Below case, Line 1 should be inactive, because _TEST_DEF_4 value is 8.

#if _TEST_DEF_4 == 1
   #define GOOD   //<<-- Line 1
#else
   #define BAD  //<<-- Line 2
#endif

I'm guessing, editor know already the final value of definition. I'd like to know the way to get the value on Slick-C
Please let me know if you have any idea.

Thanks

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6864
  • Hero Points: 528
Re: How can I get the final value of nested definition ?
« Reply #1 on: August 23, 2016, 02:37:20 PM »
SlickEdit does not do full preprocessing primarily for performance reasons but also because users don't want to provide the information necessary to find the include files (and this information would have to be exact). Worse yet, the different C++ compilers handle preprocessing differently and SlickEdit has to support any compiler tool chain.

The Selective Display preprocessing feature (View>Selective Display) comes closest to doing what you want but you must manually type in the values for defines used in expressions (in this case _TEST_DEF_4). The "Scan for Defines" button will prompt for the defines that need to have values.