It is often desirable to make assertions about the set of memory locations that a function is
Question:
It is often desirable to make assertions about the set of memory locations that a function is allowed to modify. Other memory locations remain unchanged. A specification language typically provides features to identify memory locations that might be modified by a function.
Add the modifies feature to Speclang, which allows programmers to specify which memory locations might be modified by a function, and by the corollary, that nothing else changes. An example appears here, where the function satisfies its modifies specification:
The syntax for the modifies feature is similar to the invariants features discussed in question 10.8.5. Indeed, both features have a similar flavor that specifies constraints that hold before and after the function call.
Another example appears here, where the function does not satisfies its modifies specification:
Step by Step Answer:
An Experiential Introduction To Principles Of Programming Languages
ISBN: 9780262045452
1st Edition
Authors: Hridesh Rajan