Author Topic: Tagging/Context problem with #define?  (Read 3444 times)

jkriegshauser

  • Community Member
  • Posts: 5
  • Hero Points: 0
Tagging/Context problem with #define?
« on: September 27, 2007, 06:20:41 pm »
We have several #define statements that refer to global variables, such as:

Code: [Select]
#define g_pd3dDevice DirectX9RenderDeviceData::m_pd3dDevice(Where m_pd3dDevice is a public static member of the DirectX9RenderDeviceData struct).

or singleton objects, such as:
Code: [Select]
#define gLoginServer LoginServer::getInstance()
I added the above #define statements to usercpp.h in the config directory and re-tagged the file.

When I'm editing code, if I type "g_pd3dDevice->" I would expect the members, etc for m_pd3dDevice to be displayed, but nothing happens.  Likewise if I type "gLoginServer[dot]".

The 'Auto-list members' Context Tagging/List members option is turned on (as well as everything else under List members).  Alt-dot just dings and says "No symbols found matching g_pd3dDevice".  Ctrl-dot correctly navigates to the #define statement and Ctrl-/ gives me all of the references.

Is there an elusive configuration option that I'm missing?

TIA

Joshua M. Kriegshauser
Assoc. Technical Director, EverQuest II
Sony Online Entertainment, LLC.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2627
  • Hero Points: 405
Re: Tagging/Context problem with #define?
« Reply #1 on: September 28, 2007, 02:42:52 pm »
This is a known limitation.  We have a feature request on file to attempt to handle some of these cases.

Rule of thumb, the amount of preprocessing in your code base is inversely proportional to your ability to edit it.  So, if you have any control over the source base, consider that sometimes shorthand notations are not worth the loss of tool support.

I wonder if there is any IDE who's "list members" does handle this case in an editing scenario?

jb

  • Community Member
  • Posts: 37
  • Hero Points: 0
Re: Tagging/Context problem with #define?
« Reply #2 on: April 16, 2009, 08:35:43 am »
I wonder if there is any IDE who's "list members" does handle this case in an editing scenario?

Yes there is.
EXAMPLE:
Code: [Select]
struct T
{
  int n1;
  int n2;
  //...
};

T theTWithLongName;                // external or legacy variable name that must not be changed
#define OBJ1 theTWithLongName      // define short alias

T& GetTheTWithLongName();          // external or legacy function name that must not be changed
#define OBJ2 GetTheTWithLongName() // define short alias

void AutoListTest()
{
  OBJ1.n1 = 1; // 'Auto-list members' feature works with Visual Studio 2008 and with SlickEdit 14.0.0.7.
  OBJ2.n2 = 2; // 'Auto-list members' feature works with Visual Studio 2008 but NOT with SlickEdit 14.0.0.7.
}

Visual Studio 2008 also handles more complicated cases but its tag file (ncb file) is usually much greater than SlickEdit's vtg file.