As discussed in the previous section, if object A is a specialization of object B, object A's handle can be used in functions defined on object B. When the application is built, the checks are made to see if the use of the handles is valid. Three levels of static type checking can be used:
The middle warning level is the default, but this can be changed as
follows:
Definition | Type checking level |
---|---|
#define MQEHANDLE_WARNING_LEVEL 1 | No warnings at all |
#define MQEHANDLE_WARNING_LEVEL 2 | Default level |
#define MQEHANDLE_WARNING_LEVEL 3 | Maximum warnings |
Using the example above, on the maximum warning level, the call
rc = mqeVehicle_move(hMyCar, &exceptBlock);
generates a compiler warning.
To remove this warning, convert the call to:
rc = mqeVehicle_move((MQeVehicleHndl)hMyCar, &exceptBlock);
On the lower two warning levels, this would not generate a warning.
The only overhead of changing the warning level is in the number of warnings produced during compilation.