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:image

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:image

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: