Abstract
In order to achieve good reliability, clarity, scalability and re-usability of the application high-level programs written in C++ the raw pointers should not be used as class members (fields), because the raw pointers are too dangerous in this role and they do not represent meaningful relations between objects. Instead of raw pointers two smart pointers should be used. The first one describes exclusive unique ownership with synchronization of objects copying and deletion. The second one describes inclusive references to independent alien objects with invalidating the reference at the deletion of the addressed object. All power of object-oriented programming is preserved, but difficulties and errors are eliminated.
- E. W. Dijkstra, Go to statement considered harmful. Communications of the ACM 1968; 11(3): 147--148. Google Scholar
Digital Library
- D. B. Lomet, Making Pointers Safe in System Programming Languages. IEEE Transactions on Software Engineering 1985; SE-11(1): 87--96.Google Scholar
- B. T. Denvir, On Orthogonality in Programming Languages. ACM SIGPLAN Notices, 1979, 14(7): 18--30. Google Scholar
Digital Library
- B. Stroustrup, The C++ Programming Language. (Special ed.), Addison-Wesley, 2000. Google Scholar
Digital Library
- J. R. Ellis and D. L. Detlefs, Safe, efficient garbage collection for C++. In USENIX Sixth C++ Technical Conference, 1994. http://www.usenix.org/publications/library/proceedings/c++94/full_papers/ellis_a'. Google Scholar
Digital Library
- D. L. Heine and M. S. Lam, A Practical Flow-Sensitive and Context-Sensitive C and C++ Memory Leak Detector. Proceedings of the ACM SIGPLAN 2003 Conference on Programming Language Design and Implementation (PLDF'03), June 9-11, 2003, San Diego, California, USA. Google Scholar
Digital Library
- F. V. Tkachov, Programming education: a Russian perspective. In Modular Programming Languages. Lecture Notes in Computer Science, Springer-Verlag, 2003, 2789: 69--77.Google Scholar
- J. Hogg, D. Lea, R. Holt, A. Wills, D. deChampeaux, The Geneva Convention On The Treatment of Object Aliasing. OOPS Messenger, April 1992. Google Scholar
Digital Library
- N. H. Minsky, Towards Alias-Free Pointers. Proc. 10-th European Conf. Object-Oriented Programming, Springer-Verlag, 1996, 189--209. Google Scholar
Digital Library
- P. S. Almeida, Balloon Types: Controlling Sharing of State in Data Types. In ECOOP'97 --- Object Oriented Programming, II European Conf. Lecture Notes in Computer Science 1997; 1241: 32--59. Springer.Google Scholar
- D. G. Clarke, J. M. Potter and J. Nobble, Ownership Types for Flexible Alias Protection. In ACM Conf. on Object-Oriented Programming Systems, Languages and Applications (OOPSLA'98), Vancouver, Canada, October 1998. Google Scholar
Digital Library
- J. Noble, J. Vitek and J. Potter, Flexible Alias Protection. ECOOP'98, Lecture Notes in Computer Science, Springer-Verlag, 1998; 1445: 158--185. Google Scholar
Digital Library
- J. Boyland, Alias burying: Unique variables without desctructive reads. Software --- Practice and Experience 2001; 31: 533--553. Google Scholar
Digital Library
- M. Barnett and D. A. Naumann, Friends Need a Bit More: Maintaining Inveriants Over Shared State. In Mathematics of Program Construction, Lecture Notes in Computer Science, Springer, July 2004.Google Scholar
Cross Ref
- A. Banerjee and D. Naumann, Ownership: transfer, sharing, and encapsulation, In ECOOP Workshop on Formal Techniques for Java-like Programs (FTfJP), July 2003.Google Scholar
- S. Meyers, More Effective C++. Addison-Wesley, 1996.Google Scholar
- J. J. Barton and L. R. Nackman, Scientific and Engineering C++. Addison-Wesley, 1994. Google Scholar
Digital Library
- G. Colvin, B. Dawes, P. Dimov, D. Adler, et al., The boost web site, smart pointers. 1999-2004. www.boost.org/libs/smart_ptr/smart_ptr.htm'.Google Scholar
- B. Milewski, Resource management in C++. Journal of Object Oriented Programming 1997; 10(1): 14--22.Google Scholar
- D. Lea, The GNU C++ Library, C++ Report, June 1993, revised as http://gee.cs.oswego.edu/dl/libg++paper/libg++/libg++.html, 1995.Google Scholar
- A. J. H. Simons, Borrow, Copy or Steal? Loans and Larceny in the Orthodox Canonical Form. ACM SIGPLAN Notices, Proceedings of the 13th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications (OOPSLA '98) 1998; 33(10): 65--83. Google Scholar
Digital Library
- A. Alexandrescu, Modern C++ Design: Generic Programming and Design Patterns Applied. Addison-Wesley, 2001, See chapter at http://www.informit.com. Google Scholar
Digital Library
- I. B. Smirnov, Likelihoodlib --- fitting, function maximization, and numerical analysis. PNPI Preprint 2001; 2421. http://cdsweb.cern.ch/.Google Scholar
- D. Lomet, Scheme for invalidating references to freed storage. IBM J. Res. Develop. 1975; 19(Jan): 26--35.Google Scholar
- A. Savidis, The implementation of generic smart pointers for advanced defensive programming. Software-Practice and Experience 2004; 34: 977--1009. Google Scholar
Digital Library
- D. Litman, P. F. Patel-Schneider, A. Mishra, J. Crawford, and D. Dvorak, R++: Adding Path-Based Rules to C++. IEEE Transactions on Knowledge and Data Engineering 2002, 14: 638--658. Google Scholar
Digital Library
- I. B. Smirnov, http://cern.ch/ismirnov/safetl, 2005-2007.Google Scholar
- G. Booch Object-Oriented Analysis and Design with Applications. Addison-Wesley, 1994. Google Scholar
Digital Library
- I. B. Smirnov, Modeling of ionization produced by fast charged particles in gases. Nuclear Instruments and Methods in Physics Research A 2005; 554: 474--493.Google Scholar
- I. B. Smirnov, http://cern.ch/ismirnov/heed, 2005.Google Scholar
- I. B. Smirnov, Track reconstruction for forward spectrometer of SPES4-π experiment. PNPI Preprint 2000; 2345, http://cdsweb.cern.ch/, http://cern.ch/ismirnov/track.Google Scholar
- G. D. Alkhazov, V. V. Astashin, A. G. Atamanchuk, et al., SPES4-π: installation for exclusive study of nuclear reactions. Nuclear Instruments and Methods in Physics Research A 2005; 551: 290--311.Google Scholar
Index Terms
Raw pointers in application classes of C++ considered harmful
Recommendations
The detection of dangling references in C++ programs
The smart pointer is a programming technique for the C++ language that extends the functionality of the simple pointer. Smart pointers have previously been used to support persistence, distributed objects, reference counting, and garbage collection. ...
Ironclad C++: a library-augmented type-safe subset of c++
OOPSLA '13The C++ programming language remains widely used, despite inheriting many unsafe features from C---features that often lead to failures of type or memory safety that manifest as buffer overflows, use-after-free vulnerabilities, or abstraction ...
C++ templates considered harmful
C++ is considered by many professional software developers and educators to be the lingua franca of programming languages. Once mastered, its power of expression is nearly limitless for the class of problems for which an imperative and object-oriented ...






Comments