Managed C++

In Managed C++ code, a “public ref” is appended in front of the class definition, though this is not standard C++ syntax. The extra two words cause parsing problems, and Understand does not properly scope the following member variables/functions, causing various problems.

Workaround (thanks to Grady at Rathyeon):

The MSVC Compiler predefines a macro called “_MANAGED” that can be used to work-around this problem (you may need to set the /clr argument in the compiler). This Macro is not passed into Understandsince it is dynamic, so by modifying the class definition, as follows, Understand will recognize the rest of the code correctly:

// FILE: STI.h …

#ifdef _MANAGED
public ref class STI
class STI


Note that MSVC does not work correctly unless the “class STI” is on the same line as the “public ref”.

Another note is that MSVC accepts a liberal sprinkling of the keywords “public”, “private” and “protected” in the header file. i.e. In front of enum’s definition in a namespace definition (but not within a class definition). The GNU compiler will not allow this nor does Understand for C++. The three keywords should only be used in class and struct definitions as the C++ standard directs.

A similar solution is to do this with the __UNDC__ macro provided by Understand. This macro is automatically defined in Understand, and instructs code to act in a certain way in Understand.