Displaying macros in Code Completion (C++Builder2006)
If you’ve ever used C or C++ you know about macros and their [ab]uses. Macros can be used in a number of ways, one of which is to substitute a string of text for a single identifier as in:
#define MAX_TYPEVECSIZE (sizeof(typeVec[0]) * vecLength)
you may also declare them as a parameterized macro (looks like a function call) as in:#define isVisible(t) (((t)->flags & VIS_MASK) >= VIS_PUBLIC)
Note that both of these macros are indistinguishable from regular symbols (lexical identifiers) in source code. Doesn’t code completion show you what identifiers are available in a specific context? Why yes, it does. So why doesn’t it also show the macros that are available? In fact, the ability for Code Completion to show macros has been there since BCB6 (this same trick, in the root Code Insight key, should work in that IDE as well), but it has been turned off by default for two reasons:
- There was concern that it would be seen as extra noise in the Code Completion list (I disagree with this one).
- It increases the size of the Code Completion list (and depending on which headers you’re including there could be thousands of extra macros) thus it increases the amount of time taken to show the list since the sort routine has quite a few more items to sort.
To turn it on change the value of the following registry string value to True:
xxxBDS4.0Code InsightBorland.EditOptions.CShow Macros = True
/* If there is a blank spot here, scroll down to see the rest of the blog */
Restarting the IDE should not be necessary.
You should now be able to see macros in the Code Completion list.
Share This | Email this page to a friend
Posted by Adam Markowitz archive on December 19th, 2005 under Uncategorized |

RSS Feed

December 20th, 2005 at 1:11 am
You are competing seriously to be one of my most visited blogs :-)… I feel like a dog being given a cookie every day… thanks for giving those infos… I can’t tell you if it is usefull or not since I only code in Delphi Language/Pascal… but I will wait for some "new" hidden goodie
John.
December 20th, 2005 at 2:40 am
Another useful tip!
Thanks, Sparky!
December 20th, 2005 at 6:40 am
Yup. It’s useful. Thanks! (CBuilder 6 user)
December 22nd, 2005 at 3:22 am
Wow, you have all the hidden extras
Cant wait to see what else you have waiting for us all, its like tuning into a fave series 