Studio:Scl union activate
Jump to navigation
Jump to search
The scl_union_activate pragma
The scl_union_activate pragma provides a means to map discriminant values to specific union members. It can only apply to discriminated unions that have been identified by the scl_union pragma.
A single scl_union_activate pragma prescribes the set of values for the discriminant and the member that is active for those values.
Syntax
#pragma scl_union_activate(container-specifier, union-member-specifier, constant-value-list)
Parameters | Type | Description |
container-specifier | Type | Name of the structure encapsulating the union |
union-member-specifier | Member | The active member of the union |
constant-value-list | Integer constant expression list | List of the constant expressions that the discriminant takes on to activate the union member identified in this pragma |
Notes
- The discriminant field use in scl_union_activate must have already been identified with scl_union.
Examples
Use the following links to the scl_union page to see examples of the scl_union_activate pragma:
- Explicit mapping: Discriminant values are explicitly mapped to active union members using scl_union_activate().
- Explicit mapping of multiple discriminant values to a single active member.
- Unmapped discriminant values indicating no member is active.
- Discriminant values defined by macros.
See Also
- The scl_union pragma page.
- For additional information on the scl_union_activate pragma, including constraints, refer to the section on scl_union_activate in the [SCL Reference Guide].