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


2.4 Modules and Files

As in C++, each Larch/C++ specification file is a module. (Note that a class is not a module, but may sometimes be the only thing in a module.) A module may include other modules, using the usual #include syntax of C++. A module may also contain statements about what trait(s) to use, and specifications.

It was an early convention, still preserved in many examples, to have the names of a Larch/C++ specification file ends in the suffix `.lcc'. For example `date.lcc' might be the name of a file that contained the module specifying the class date. However, this is no longer, strictly speaking, necessary. Now one may use any suffix desired, such as `date.h' or `date.lh'. One of these is more appropriate if the specification can also be used directly as a C++ header file.

As in C++, declarations in a module may be hidden or exported. A hidden declaration should be marked with the C++ keyword static. Exported declarations should not be so marked. See section 9 Specification Modules for an example.

The #include mechanism has the same semantics as C++ (see section r.16 of [Stroustrup91]). The Larch/C++ tools use a C++ preprocessor as a first phase, exactly as in C++.

While Larch/C++ uses the C++ #include syntax, one does not necessarily have to use separate "header" modules for Larch/C++ specifications. Typically Larch/C++ specification will be found in C++ header modules.


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