Skip to content

Commit 4b028fe

Browse files
committed
Using null exclusion on the access discriminant
1 parent 8b2af4a commit 4b028fe

File tree

1 file changed

+4
-4
lines changed
  • content/courses/ada-in-practice/chapters

1 file changed

+4
-4
lines changed

content/courses/ada-in-practice/chapters/raii.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ a tagged limited private type with a discriminant designating a
305305

306306
.. code-block:: ada
307307
308-
type Lock_Manager (Lock : access Mutual_Exclusion) is
308+
type Lock_Manager (Lock : not null access Mutual_Exclusion) is
309309
tagged limited private;
310310
311311
We make it a limited type because copying doesn't make sense semantically for
@@ -320,7 +320,7 @@ that the type will be controlled because we don't intend :ada:`Initialize` and
320320

321321
.. code-block:: ada
322322
323-
type Lock_Manager (Lock : access Mutual_Exclusion) is
323+
type Lock_Manager (Lock : not null access Mutual_Exclusion) is
324324
new Ada.Finalization.Limited_Controlled with null record;
325325
326326
No additional record components are required, beyond the access discriminant.
@@ -348,12 +348,12 @@ The full package spec is as follows:
348348
(Initially_Available => True,
349349
Ceiling => Default_Ceiling);
350350
351-
type Lock_Manager (Lock : access Mutual_Exclusion) is
351+
type Lock_Manager (Lock : not null access Mutual_Exclusion) is
352352
tagged limited private;
353353
354354
private
355355
356-
type Lock_Manager (Lock : access Mutual_Exclusion) is
356+
type Lock_Manager (Lock : not null access Mutual_Exclusion) is
357357
new Ada.Finalization.Limited_Controlled with null record;
358358
359359
overriding procedure Initialize (This : in out Lock_Manager);

0 commit comments

Comments
 (0)