7.7.1.17. C++ Support within GEL ExpressionsΒΆ

The following C++ enhancements have been added to the GEL expression syntax.

Access to data members

The '.' and '->' operators (direct and indirect member selection) have been extended to allow access to data members of classes. All data members are accessible, regardless of C++ access type (public, protected, or private). Data members of base classes are also available (unless shadowed by members of the derived class with the same name). Member names that would be considered ambiguous by a C++ compiler are resolved by Code Composer Studio to one of the possible matches.

Qualified identifiers

Variable identifiers may be fully or partially-qualified. Global or class static functions or variables are accessible using the :: scope operator (for instance, std::malloc, or MyClass::static_var). The current scope is determined by the Program Counter (PC), and inner scopes take precedence over outer.

For example, if the PC is currently in the function:

N1::C1::C2::f(int)

and the identifier C1::b is evaluated, it will match any of these fully-qualified identifiers (in order of precedence)

N1::C1::C2::C1::b N1::C1::C2::b N1::C1::b C1::b

Nested types must be referred to by their fully-qualified name.

'this' pointer

When the PC is in a member function, the this pointer to the associated object is available.

Implicit access to class members

When the PC is in a member function, any data members of the class (or base classes) are available directly, without needing to be explicitly indirected from this. For example, m_x will resolve to this->m_x (assuming no local variable shadows it).

Casting object pointers

The C/C++ pointer cast operation (Type \*) value can be used to navigate class hierarchies, adjusting pointers where necessary. Similar to the C++ compiler, a static_cast is performed where possible, otherwise a reinterpret_cast is performed. (Derived \*) base and (Base \*) derived perform correctly even in the presence of multiple inheritance.

___

See also:

GEL Functions: Alphabetical List