1979 => B.Stroustrup: Adding Classes to C . in Software On the development of C++ On the development of C++ Practice and Experience, Feb, Game Engine Architecture Game Engine Architecture 1983, pp. 139-161. � 1998 ISO C++ Standard officially adopted. 776 p. 1998 ISO C++ Standard officially adopted. 776 p. Spring 2017 Spring 2017 � RTTI, namespaces, export export , , bool bool , new cast syntax, many template RTTI, namespaces, , new cast syntax, many template extensions, exception specifications, etc., std::string std::string , extensions, exception specifications, etc., , STL STL 1. Modern C++ (11/14) for Game Engines 1. Modern C++ (11/14) for Game Engines 1. Modern C++ (11/14) for Game Engines 1. Modern C++ (11/14) for Game Engines � 2003 ISO standard revision (bug fix release for C++98) 2003 ISO standard revision (bug fix release for C++98) � � 2003 2003 Library Library TR1: likely components, TR1: likely components, hash hash map, regex, smart pointers.. map, regex, smart pointers.. � Juha Vihavainen Juha Vihavainen � 2006 2006 Performance Performance TR: A TR: A report on C++ performance issues report on C++ performance issues � University of Helsinki University of Helsinki � 2009: Selected “C++0x” features became commonly available 2009: Selected “C++0x” features became commonly available � � 2011 ISO Standard ("C++0x" => "C++11/14"). 1353 p. 2011 ISO Standard ("C++0x" => "C++11/14"). 1353 p. � [Gregory, Ch. 3 [Gregory, Ch. 3 Fundamentals of SE for Games [Gregory, Ch. 3 Fundamentals of SE for Games [Gregory, Ch. 3 Fundamentals of SE for Games ] Fundamentals of SE for Games ] ] ] auto auto , auto auto , , static_assert , static_assert static_assert , static_assert , , constexpr , constexpr constexpr , constexpr , , uniform initialization , uniform initialization uniform initialization , uniform initialization , , move semantic, , move semantic, move semantic, move semantic, [Josuttis, Ch. 3 New Language Features [Josuttis, Ch. 3 New Language Features ] ] lambda expressions , lambda expressions , threads, futures threads, futures , , locks locks , spec. of "machine model", , spec. of "machine model", template aliases, variadic templates, extern extern ("do not instantiate here template aliases, variadic templates, ("do not instantiate here ") ") [ [Lakos Lakos, , Large Large- -Scale C++ Software Design Scale C++ Software Design ] ] " for generics (yet); removed export export , , auto_ptr auto_ptr , and old � no " no " concepts concepts " for generics (yet); removed , and old � version of exception specifications (that had proved to be bad ideas) version of exception specifications (that had proved to be bad ideas) 2.2.2017 2.2.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 2 A (simplified) family tree of C++ (Stroustup, 2014) A (simplified) family tree of C++ (Stroustup, 2014) On C++ type safety (refreshment) On C++ type safety (refreshment) C++ is not not guaranteed to be statically or dynamically type safe C++ is guaranteed to be statically or dynamically type safe � "a programming language designed for general and performance "a programming language designed for general and performance � modelling experience with critical systems programming with the ability to manipulate critical systems programming with the ability to manipulate Simula (PhD thesis) => how to efficiently utilize hardware cannot be type safe" [Stroustrup] hardware cannot be type safe" [Stroustrup] hardware cannot be type safe" [Stroustrup] hardware cannot be type safe" [Stroustrup] how to efficiently utilize classes and inheritance assures such "unsafety", t oo oo � the goal of preserved the goal of preserved C compatibility compatibility assures such "unsafety", t � Some problems (mostly features inherited from C) Some problems (mostly features inherited from C) .. other influences: Clu, Algol68, Ada: � untagged unions (binary data reinterpreted as the current variant) untagged unions (binary data reinterpreted as the current variant) � exceptions, generics, � explicit (and some implicit) unsafe type conversions (casts) explicit (and some implicit) unsafe type conversions (casts) � overloading.. � pointers and arrays without (guaranteed) checks � pointers and arrays without (guaranteed) checks pointers and arrays without (guaranteed) checks pointers and arrays without (guaranteed) checks � � � ability to deallocate a free store (heap) object while holding on to its ability to deallocate a free store (heap) object while holding on to its � "dangling" pointer (allowing post- "dangling" pointer (allowing post -allocation access) allocation access) � deallocating an object not allocated, double deallocations.. deallocating an object not allocated, double deallocations.. � 2.2.2017 2.2.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 3 2.2.2017 2.2.2017 Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 4
Recommend
More recommend