Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1167473.1167503acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
Article

An operational semantics and type safety prooffor multiple inheritance in C++

Published: 16 October 2006 Publication History

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++.

References

[1]
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.]]
[2]
Isabelle Attali, Denis Caromel, and Sidi Ould Ehmety. A natural semantics for Eiffel dynamic binding. ACM TOPLAS, 18(6):711--729, 1996.]]
[3]
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.]]
[4]
Gilad Bracha and William Cook. Mixin-based inheritance. In Proc. of OOPSLA/ECOOP'90, pages 303--311, 1990.]]
[5]
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.]]
[6]
Luca Cardelli. A semantics of multiple inheritance. Information and Computation, 76:138--164, 1988.]]
[7]
Luca Cardelli. Type systems. In The Computer Science and Engineering Handbook. 2 edition, 2004.]]
[8]
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.]]
[9]
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.]]
[10]
Paul Jolly, Sophia Drossopoulou, Christopher Anderson, and KlausOstermann. Simple dependent types: Concord. In Proc. of FTfJP'05, 2005.]]
[11]
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.]]
[12]
Henry Lieberman. Using prototypical objects to implement shared behavior in object-oriented systems. In Proc. of OOPSLA'86, pages 214--223, 1986.]]
[13]
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.]]
[14]
Robin Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17(3):348--375, 1978.]]
[15]
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/.]]
[16]
Nathaniel Nystrom, Stephen Chong, and Andrew C. Myers. Scalable extensibility via nested inheritance. In Proc. of OOPSLA'04, pages 99--115, 2004.]]
[17]
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.]]
[18]
Martin Odersky, Vincent Cremet, Christine Röckl, and Matthias Zenger. A nominal theory of objects with dependent types. In Proc. of ECOOP'03.]]
[19]
Benjamin C. Pierce. Types and Programming Languages. The MIT Press, 2002.]]
[20]
G. Ramalingam and Harini Srinivasan. A member lookup algorithm for C++. In Proc. of PLDI '97, pages 18--30, 1997.]]
[21]
Jonathan G. Rossie, Jr. and Daniel P. Friedman. An algebraic semantics of subobjects. In Proc. of OOPSLA'95, pages 187--199. ACM Press, 1995.]]
[22]
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.]]
[23]
Adam Seligman. FACTS: A formal analysis for C++. Williams College, 1995. Undergraduate thesis.]]
[24]
Gregor Snelting and Frank Tip. Understanding class hierarchies using concept analysis. ACM TOPLAS, pages 540--582, 2000.]]
[25]
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.]]
[26]
Mirko Streckenbach and Gregor Snelting. Refactoring Class Hierarchies with KABA. In Proc. of OOPSLA'04, pages 315--330, 2004.]]
[27]
Bjarne Stroustrup. Multiple inheritance for C++. Computing Systems, 2(4), 1989.]]
[28]
Bjarne Stroustrup. The Design and Evolution of C++. Addison Wesley, 1994.]]
[29]
Bjarne Stroustrup. The C++ Standard: Incorporating Technical Corrigendum No. 1. John Wiley, 2 edition, 2003.]]
[30]
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.]]
[31]
Peter F. Sweeney and Joseph Gil. Space and time-efficient memory layout for multiple inheritance. In Proc. of OOPSLA'99, pages 256--275, 1999.]]
[32]
Ewan Tempero and Robert Biddle. Simulating multiple inheritance in Java. Journal of Systems and Software, 55:87--100, 2000.]]
[33]
Krishnaprasad Thirunarayan, Günter Kniesel, and Haripriyan Hampapuram. Simulating multiple inheritance and generics in Java. Computer Languages, 25:189--210, 1999.]]
[34]
Frank Tip and Peter Sweeney. Class hierarchy specialization. Acta Informatica, 36:927--982, 2000.]]
[35]
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.]]
[36]
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.]]
[37]
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.]]
[38]
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.]]
[39]
Andrew K. Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, (115):38--94, 1994.]]
[40]
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.]]

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
OOPSLA '06: Proceedings of the 21st annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications
October 2006
514 pages
ISBN:1595933484
DOI:10.1145/1167473
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 41, Issue 10
    Proceedings of the 2006 OOPSLA Conference
    October 2006
    480 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1167515
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 16 October 2006

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. C++
  2. multiple inheritance
  3. semantics
  4. type safety

Qualifiers

  • Article

Conference

OOPSLA06
Sponsor:

Acceptance Rates

Overall Acceptance Rate 268 of 1,244 submissions, 22%

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)18
  • Downloads (Last 6 weeks)1
Reflects downloads up to 26 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2020)Thriving in a crowded and changing world: C++ 2006–2020Proceedings of the ACM on Programming Languages10.1145/33863204:HOPL(1-168)Online publication date: 12-Jun-2020
  • (2018)Illi Isabellistes Se Custodes Egregios PraestabantPrincipled Software Development10.1007/978-3-319-98047-8_17(267-282)Online publication date: 24-Oct-2018
  • (2014)An operational semantics for object-oriented concepts based on the class hierarchyFormal Aspects of Computing10.1007/s00165-012-0259-y26:3(491-535)Online publication date: 1-May-2014
  • (2013)Towards Formal Verification of a Commercial Wireless Router FirmwareProceedings of the 2013 IEEE 37th Annual Computer Software and Applications Conference10.1109/COMPSAC.2013.103(639-647)Online publication date: 22-Jul-2013
  • (2012)Open and efficient type switch for C++ACM SIGPLAN Notices10.1145/2398857.238468647:10(963-982)Online publication date: 19-Oct-2012
  • (2012)Open and efficient type switch for C++Proceedings of the ACM international conference on Object oriented programming systems languages and applications10.1145/2384616.2384686(963-982)Online publication date: 19-Oct-2012
  • (2012)A mechanized semantics for C++ object construction and destruction, with applications to resource managementProceedings of the 39th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages10.1145/2103656.2103718(521-532)Online publication date: 25-Jan-2012
  • (2012)An executable formal semantics of C with applicationsACM SIGPLAN Notices10.1145/2103621.210371947:1(533-544)Online publication date: 25-Jan-2012
  • (2012)A mechanized semantics for C++ object construction and destruction, with applications to resource managementACM SIGPLAN Notices10.1145/2103621.210371847:1(521-532)Online publication date: 25-Jan-2012
  • (2012)Clarifying and compiling C/C++ concurrencyACM SIGPLAN Notices10.1145/2103621.210371747:1(509-520)Online publication date: 25-Jan-2012
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media