Larch/C++ adopts the distinction between declarations and definitions from C++ (Section 3.1 of [Ellis-Stroustrup90]). That is, a declaration tells the reader about the properties of a name. A definition, in addition, specifies the value to be associated with a name, or in the case of a variable definition, specifies that storage should be allocated. More formally, we adopt the exact distinction from C++, except that instead of a function body, a function specification makes what would otherwise be only a function declaration into a function definition.
For example, the following are definitions.
int i; struct rat { public: int num; int denom; }; int inc(int count) { count = count + 1; }
However the following are only declarations.
extern int i; struct rat; extern int inc(int count);
In any scope unit (see section 2.6 Scope Rules), there can be only one definition of a C++ name, or a function with a given list of argument types, in a Larch/C++ specification. However, declarations can be repeated, and LSL trait functions can have multiple overloadings with the same list of argument types.
Go to the first, previous, next, last section, table of contents.