Publication | Closed Access
Using and Porting GNU CC
185
Citations
0
References
1998
Year
Unknown Venue
Abstract Virtual ClassesEngineeringProgram AnalysisStandard C++Programming Language ImplementationSoftware EngineeringGnu CcIntermediate RepresentationOptimizing CompilerVirtual Classes
virtual classes provide somewhat similar facilities in standard C++. There are two main advantages to using signatures instead: 1. Subtyping becomes independent from inheritance. A class or signature type T is a subtype of a signature type S independent of any inheritance hierarchy as long as all the member functions declared in S are also found in T. So you can de ne a subtype hierarchy that is completely independent from any inheritance (implementation) hierarchy, instead of being forced to use types that mirror the class inheritance hierarchy. 2. Signatures allow you to work with existing class hierarchies as implementations of a signature type. If those class hierarchies are only available in compiled form, you're out of luck with abstract virtual classes, since an abstract virtual class cannot be retro tted on top of existing class hierarchies. So you would be required to write interface classes as subtypes of the abstract virtual class. There is one more detail about signatures. A signature declaration can contain member function de nitions as well as member function declarations. A signature member function with a full de nition is called a default implementation; classes need not contain that particular interface in order to conform. For example, a class C can conform to the signature signature T { int f (int); int f0 () { return f (0); }; }; whether or not C implements the member function `int f0 ()'. If you de ne C::f0, that de nition takes precedence; otherwise, the default implementation S::f0 applies. 170 Using and Porting GNU CC Chapter 8: gcov: a Test Coverage Program 171 8 gcov: a Test Coverage Program gcov is a tool you can use, together with GNU CC, to test code coverage in your programs. gcov is free software, but for the moment it is only available from Cygnus Support (pending discussions with the FSF about how they think Cygnus should really write it). This chapter describes version 1.5 of gcov. Jim Wilson wrote gcov, and the original form of this note. Pat McGregor edited the documentation. 8.