Skip to content

Commit b0fa33b

Browse files
committed
add enum representation clauses
1 parent 1bee9c3 commit b0fa33b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

courses/fundamentals_of_ada/adv_280_low_level_programming.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,21 @@ Pack Aspect
208208
pragma Pack (Ar);
209209
-- Rec'Size is 36, Ar'Size is 1000
210210
211+
-------------------------------
212+
Enum Representation Clauses
213+
-------------------------------
214+
215+
* Can specify representation for each value
216+
* Representation must have increasing number
217+
218+
.. code:: Ada
219+
220+
type E is (A, B, C);
221+
for E use (A => 2, B => 4, C => 8);
222+
223+
* Can use :ada:`E'Enum_Rep (A) = 2`
224+
* Can use :ada:`E'Enum_Val (2) = A`
225+
211226
-------------------------------
212227
Record Representation Clauses
213228
-------------------------------

0 commit comments

Comments
 (0)