Microsoft KB Archive/190965

= Two IntelliSense limitations will occur when you work with macro definitions in Visual C++ 6.0 =

Article ID: 190965

Article Last Modified on 6/2/2005

-

APPLIES TO


 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q190965



SYMPTOMS
When you are working with macro definitions in Microsoft Visual C++, the following two IntelliSense limitations occur:
 * IntelliSense does not dynamically resolve macro definitions.
 * Using #ifdef or #ifndef to define functions produces unexpected results.



STATUS
Microsoft is researching these problems and will post new information here in the Microsoft Knowledge Base as it becomes available.



IntelliSense does not dynamically resolve macro definitions
Visual C++ 6.0 does not preprocess any macros while code is being edited. Because of this, IntelliSense does not appear as it would if the macro were not used. For example, the following TEST_FUNC macro aliases the Test function: void Test(char *pszName); void Test(char *pszName){ printf("Name = %s", pszName); } In another part of the code, typing "Test" followed by an open parenthesis displays the Parameter Info ToolTip for the Test function. However, typing "TEST_FUNC" followed by an open parenthesis does not activate IntelliSense, even though it will become the Test function when it is compiled. This same limitation applies to many other uses of macros, because IntelliSense does not dynamically resolve macros to known identifiers.
 * 1) define TEST_FUNC Test

This limitation can also cause problems with standard functions and structures. Although most of the standard Win32 functions are handled properly, some header files use macros to alias functions and structures. This can result in IntelliSense not recognizing the macro. To verify whether this may be the cause of the problem, search for the structure or function in the VC98\Include directory. If the documented function or structure is actually a macro, this could explain why IntelliSense is not recognizing it.

Using #ifdef or #ifndef to define functions produces unexpected results
When functions are conditionally defined using #ifdef or #ifndef, IntelliSense first determines whether the constant is defined in the project. If the macro is defined, IntelliSense displays information on the correct function. If the macro is undefined in the project, IntelliSense displays information for the first function, regardless of whether #ifdef or #ifndef is used. IntelliSense can not predict whether a constant will be defined, because constants can be set with compiler switches. Do not depend on IntelliSense to always provide the appropriate information when code is conditionally included in this way.

