The current release candidate of itemis CREATE PRO is still missing some C functionalities that will be approached as soon as possible by subsequent releases. Among others, the following issues are known to be not available yet:
Syntax issue when declaring nested pointers.
Copy link to clipboard
There is a known syntax issue when declaring nested pointers in the statechart’s definition section. It is required to put a space
between every closing character (>) after declaring the type for the pointer.
Type range validations are currently not implemented. As a consequence, it is possible to e.g., assign an
int32_t value to an
int8_t variable one without any warning.
In C it is possible to define structs, unions and enums without a
typedef. They can be referenced by using the corresponding qualifying keyword (
struct,
union, or
enum, respectively). As the statechart language does
not support these qualifiers, the usage of struct, union and enumeration types is currently restricted to those defined by a
typedef.
Using the C/C++ domain, it is possible to call functions that are declared in header files. The generated code will do this correctly, but the simulation will not actually evaluate the functions, for multiple reasons:
- Parsing and interpreting C-Code completely and correctly with all possible side effects is very hard and we could never guarantee that itemis CREATE does the right thing in the simulation.
- Even if we could do that, the Compiler can link against one of many possible implementations of the same declaration, and choosing the correct one would be pretty hard, too.
Due to this, we decided not to implement this feature, and doing so is currently not on our roadmap.
However, when using our testing framework SCTUnit, you have the option to mock these functions, and these mocks are then called during testing.
Using the C/C++ domain allows you to import classes defined in a C++ header file, and use them as types. This means that you can instantiate objects of these types just like in regular C++ code. However, itemis CREATE currently does not support constructors, so there are certain limitations:
- If the class has a default constructor with no arguments, you can just declare the variable as usual in the statechart:
var o: MyClass
. The constructor of the generated statechart class will then automatically call the default constructor of
MyClass
to instantiate the object.
- If the class does not have a default constructor, this will fail. In this case, you should declare a pointer instead:
var o: pointer<MyClass>
- this way, the constructor of the statechart does nothing at all. Instead, you can then assign a proper value to it, ideally
after you call the statechart’s
init
-function, and
before you call the
enter
-function. This ensures correct initialization before the statechart is running.
Please note that the preceding list of restrictions might not be complete. If you discover any further problems, please do not hesitate to contact us! Your feedback is highly appreciated!