A scope unit is an area of specification text within which declarations may have effect, within which multiple definitions of the same name are prohibited, and outside of which declarations inside the unit do not have effect. The scope units in Larch/C++ are as in C++ (Section 3.2 of [Ellis-Stroustrup90] and Section r.3.3.1 of [Stroustrup94]), with the addition of a scoping unit for function specifications, spec-cases, and quantifiers.
The new scope units in Larch/C++ are as follows.
quantifier [ quantifier ] ...is a scope unit.(
term)
The scope rules of Larch/C++ are exactly as in C++ (Section 10.4 of [Ellis-Stroustrup90] with the addition of namespaces as in [Stroustrup94]), with the following additions.
counter
is the body of the specification of inc_counter
.
// @(#)$Id: inc_counter.lh,v 1.8 1997/06/03 20:30:07 leavens Exp $ extern int inc_counter(void) throw(); //@ behavior { //@ extern int counter; //@ requires assigned(counter, pre) /\ counter^ < INT_MAX; //@ modifies counter; //@ ensures counter' = counter + 1; //@ }(Unlike previous versions of Larch/C++, no exception to the usual C++ scope rules is made for function specifications. That is, global variables are visible within function specifications, and do not necessarily need to be declared as above. However, it is considered good style in a function specification to declare global variables that may be read or written.)
i:int
is the rest of the line following i:int
.
\A i: int (i < INT_MAX \implies (i < i + 1))
Go to the first, previous, next, last section, table of contents.