-
Notifications
You must be signed in to change notification settings - Fork 31
Evaluate Implied Enum Constants
Robert L. Bocchino Jr. edited this page Apr 18, 2024
·
3 revisions
This algorithm traverses the a source model and computes the implied values of enumeration constants that have no explicit value.
-
A list tul of translation units.
-
An analysis data structure a representing the results of analysis so far.
-
The analysis a with an updated value map, if the evaluation succeeds; otherwise an error.
For each enum definition d:
-
Check that d has all explicit constants C
=
e or all implied constants C. If not, throw an error. -
If d has implied constants, then add the implicit values 0, 1, 2, … to the value map.