File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
courses/fundamentals_of_ada Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -232,6 +232,33 @@ Unbounded String Implementation
232
232
end Adjust;
233
233
end Unbounded_String_Pkg;
234
234
235
+ ------------------
236
+ Finalizable Aspect
237
+ ------------------
238
+
239
+ * Uses the GNAT-specific :ada: `with Finalizable ` aspect
240
+
241
+ .. code :: Ada
242
+
243
+ type Ctrl is record
244
+ Id : Natural := 0;
245
+ end record
246
+ with Finalizable => (Initialize => Initialize,
247
+ Adjust => Adjust,
248
+ Finalize => Finalize,
249
+ Relaxed_Finalization => True);
250
+
251
+ procedure Adjust (Obj : in out Ctrl);
252
+ procedure Finalize (Obj : in out Ctrl);
253
+ procedure Initialize (Obj : in out Ctrl);
254
+
255
+ * :ada: `Initialize `, :ada: `Adjust ` same definition as previously
256
+ * :ada: `Finalize ` has the :ada: `No_Raise ` aspect: it cannot raise exceptions
257
+ * :ada: `Relaxed_Finalization `
258
+
259
+ * Performance on-par with C++'s destructor
260
+ * No automatic finalization of **heap-allocated ** objects
261
+
235
262
========
236
263
Lab
237
264
========
You can’t perform that action at this time.
0 commit comments