ABSTRACT
We present an operational semantics and type safety proof for multiple inheritance in C++. The semantics models the behaviour of method calls, field accesses, and two forms of casts in C++ class hierarchies exactly, and the type safety proof was formalized and machine-checked in Isabelle/HOL. Our semantics enables one, for the first time, to understand the behaviour of operations on C++ class hierarchies without referring to implementation-level artifacts such as virtual function tables. Moreover, it can - as the semantics is executable - act as a reference for compilers, and it can form the basis for more advanced correctness proofs of, e.g., automated program transformations. The paper presents the semantics and type safety proof, and a discussion of the many subtleties that we encountered in modeling the intricate multiple inheritance model of C++.
- David Aspinall. Proof General - a generic tool for proof development. In S. Graf and M. I. Schwartzbach, editors, Tools and Algorithms for Construction and Analysis of Systems, TACAS 2000, volume 1785 of Lect. Notes in Comp. Sci., pages 38--42. Springer-Verlag, 2000.]] Google Scholar
Digital Library
- Isabelle Attali, Denis Caromel, and Sidi Ould Ehmety. A natural semantics for Eiffel dynamic binding. ACM TOPLAS, 18(6):711--729, 1996.]] Google Scholar
Digital Library
- Stefan Berghofer and Tobias Nipkow. Executing Higher Order Logic. In P. Callaghan, Z. Luo, J. McKinna, and R. Pollack, editors, Types for Proofs and Programs (TYPES 2000), volume 2277 of LNCS. Springer-Verlag, 2002.]] Google Scholar
Digital Library
- Gilad Bracha and William Cook. Mixin-based inheritance. In Proc. of OOPSLA/ECOOP'90, pages 303--311, 1990.]] Google Scholar
Digital Library
- V. Breazu-Tannen, C. A. Gunter, and A. Scedrov. Computing with coercions. In Proc. ACM Conf. LISP and functional programming, pages 44--60. ACM Press, 1990.]] Google Scholar
Digital Library
- Luca Cardelli. A semantics of multiple inheritance. Information and Computation, 76:138--164, 1988.]] Google Scholar
Digital Library
- Luca Cardelli. Type systems. In The Computer Science and Engineering Handbook. 2 edition, 2004.]]Google Scholar
- Sophia Drossopoulou and Susan Eisenbach. Java is type safe - probably. In Proc. of ECOOP'97, volume 1241 of Lect. Notes in Comp. Sci., pages 389--418, 1997.]]Google Scholar
- Michale Hohmuth and Hendrik Tews. The semantics of C++ data types: Towards verifying low-level system components. In D. Basin and B. Wolff, editors, Theorem Proving in Higher Order Logics, Emerging Trends Proc., pages 127--144. Universität Freiburg, 2003. Tech. Rep. 187.]]Google Scholar
- Paul Jolly, Sophia Drossopoulou, Christopher Anderson, and KlausOstermann. Simple dependent types: Concord. In Proc. of FTfJP'05, 2005.]]Google Scholar
- Gerwin Klein and Tobias Nipkow. A machine-checked model for a Java-like language, virtual machine and compiler. ACM TOPLAS, 28(4):619--695, 2006.]] Google Scholar
Digital Library
- Henry Lieberman. Using prototypical objects to implement shared behavior in object-oriented systems. In Proc. of OOPSLA'86, pages 214--223, 1986.]] Google Scholar
Digital Library
- Ole Lehrmann Madsen and Birger Moeller-Pedersen. Virtual classes: A powerful mechanism in object-oriented programming. In Proc. of OOPSLA'89, pages 397--406, 1989.]] Google Scholar
Digital Library
- Robin Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17(3):348--375, 1978.]]Google Scholar
- Tobias Nipkow, Lawrence Paulson, and Markus Wenzel. Isabelle/HOL - A Proof Assistant for Higher-Order Logic, volume 2283 of Lect. Notes in Comp. Sci. 2002. http://www.in.tum.de/~nipkow/LNCS2283/.]]Google Scholar
- Nathaniel Nystrom, Stephen Chong, and Andrew C. Myers. Scalable extensibility via nested inheritance. In Proc. of OOPSLA'04, pages 99--115, 2004.]] Google Scholar
Digital Library
- Martin Odersky, Philippe Altherr, Vincent Cremet, Burak Emir, Sebastian Maneth, Stéphane Micheloud, Nikolay Mihaylov, Michel Schinz, Erik Stenman, and Matthias Zenger. An overview of the Scala programming language. Technical Report IC/2004/64, école Polytechnique Fédérale de Lausanne, Lausanne, Switzerland, 2004. Available from scala.epfl.ch.]]Google Scholar
- Martin Odersky, Vincent Cremet, Christine Röckl, and Matthias Zenger. A nominal theory of objects with dependent types. In Proc. of ECOOP'03.]]Google Scholar
- Benjamin C. Pierce. Types and Programming Languages. The MIT Press, 2002.]] Google Scholar
Digital Library
- G. Ramalingam and Harini Srinivasan. A member lookup algorithm for C++. In Proc. of PLDI '97, pages 18--30, 1997.]] Google Scholar
Digital Library
- Jonathan G. Rossie, Jr. and Daniel P. Friedman. An algebraic semantics of subobjects. In Proc. of OOPSLA'95, pages 187--199. ACM Press, 1995.]] Google Scholar
Digital Library
- Jonathan G. Rossie, Jr., Daniel P. Friedman, and Mitchell Wand. Modeling subobject-based inheritance. In Proc. of ECOOP'96, volume 1098 of Lect. Notes in Comp. Sci., pages 248--274, 1996.]] Google Scholar
Digital Library
- Adam Seligman. FACTS: A formal analysis for C++. Williams College, 1995. Undergraduate thesis.]]Google Scholar
- Gregor Snelting and Frank Tip. Understanding class hierarchies using concept analysis. ACM TOPLAS, pages 540--582, 2000.]] Google Scholar
Digital Library
- Gregor Snelting and Frank Tip. Semantics-based composition of class hierarchies. In Proc. of ECOOP'02, volume 2374 of Lect. Notes in Comp. Sci., pages 562--584, 2002.]] Google Scholar
Digital Library
- Mirko Streckenbach and Gregor Snelting. Refactoring Class Hierarchies with KABA. In Proc. of OOPSLA'04, pages 315--330, 2004.]] Google Scholar
Digital Library
- Bjarne Stroustrup. Multiple inheritance for C++. Computing Systems, 2(4), 1989.]]Google Scholar
- Bjarne Stroustrup. The Design and Evolution of C++. Addison Wesley, 1994.]] Google Scholar
Digital Library
- Bjarne Stroustrup. The C++ Standard: Incorporating Technical Corrigendum No. 1. John Wiley, 2 edition, 2003.]]Google Scholar
- Peter F. Sweeney and Michael G. Burke. Quantifying and evaluating the space overhead for alternative C++ memory layouts. Software: Practice and Experience, 33(7):595--636, 2003.]] Google Scholar
Digital Library
- Peter F. Sweeney and Joseph Gil. Space and time-efficient memory layout for multiple inheritance. In Proc. of OOPSLA'99, pages 256--275, 1999.]] Google Scholar
Digital Library
- Ewan Tempero and Robert Biddle. Simulating multiple inheritance in Java. Journal of Systems and Software, 55:87--100, 2000.]] Google Scholar
Digital Library
- Krishnaprasad Thirunarayan, Günter Kniesel, and Haripriyan Hampapuram. Simulating multiple inheritance and generics in Java. Computer Languages, 25:189--210, 1999.]]Google Scholar
Digital Library
- Frank Tip and Peter Sweeney. Class hierarchy specialization. Acta Informatica, 36:927--982, 2000.]] Google Scholar
Digital Library
- John Viega, Bill Tutt, and Reimer Behrends. Automated delegation is a viable alternative to multiple inheritance in class based languages. Technical Report CS-98-3, University of Virginia, 1998.]] Google Scholar
Digital Library
- Charles Wallace. The semantics of the C++ programming language. In E. Börger, editor, Specification and Validation Methods, pages 131--164. Oxford University Press, 1995.]] Google Scholar
Digital Library
- Daniel Wasserrab, Tobias Nipkow, Gregor Snelting, and Frank Tip. An Operational Semantics and Type Safety Proof for C++-like Multiple Inheritance. Technical Report RC23709, IBM, 2005.]]Google Scholar
- Markus Wenzel. Isabelle/Isar - A Versatile Environment for Human-Readable Formal Proof Documents. PhD thesis, Institut für Informatik, Technische Universität München, 2002. http://tumb1.biblio.tu-muenchen.de/publ/diss/in/2002/wenzel.html.]]Google Scholar
- Andrew K. Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, (115):38--94, 1994.]] Google Scholar
Digital Library
- Yoav Zibin and Joseph Gil. Two-dimensional bi-directional object layout. In Proc. of ECOOP'03, volume 3013 of Lect. Notes in Comp. Sci., pages 329--350, 2003.]]Google Scholar
Index Terms
An operational semantics and type safety prooffor multiple inheritance in C++
Recommendations
Formal verification of object layout for c++ multiple inheritance
POPL '11Object layout - the concrete in-memory representation of objects - raises many delicate issues in the case of the C++ language, owing in particular to multiple inheritance, C compatibility and separate compilation. This paper formalizes a family of C++ ...
An operational semantics and type safety prooffor multiple inheritance in C++
Proceedings of the 2006 OOPSLA ConferenceWe present an operational semantics and type safety proof for multiple inheritance in C++. The semantics models the behaviour of method calls, field accesses, and two forms of casts in C++ class hierarchies exactly, and the type safety proof was ...
Type checking modular multiple dispatch with parametric polymorphism and multiple inheritance
OOPSLA '11In previous work, we presented rules for defining overloaded functions that ensure type safety under symmetric multiple dispatch in an object-oriented language with multiple inheritance, and we showed how to check these rules without requiring the ...







Comments