Go to the first, previous, next, last section, table of contents.


6.3 Allocation and Deallocation

In Larch/C++, the traits for objects, and the built-in C++ types have trait functions that allow you to specify whether an object is allocated or not. The trait function for this purpose is named allocated, and it has many overloading for different sorts. Generally, it takes an object and a state (such as pre or post) as an argument. See section 6.2.2 Allocated and Assigned for the trait functions that are part of the built-in types.

In addition, Larch/C++ provides syntactic support for asserting that an object is newly allocated (fresh), and for specifying what objects are considered "trashed" or potentially deallocated by a function (the trashes-clause and trashed). Unless the trashes-clause is used, a function is not allowed to deallocate objects. These ideas are discussed in the subsections that follow.


Go to the first, previous, next, last section, table of contents.