Lecturer - Yosef Halakhmi
Contact me at: yhalahmi@post.tau.ac.il
Prerequisites
This course is for students, which are experienced with C++ or another OO language
and Object Oriented Approach.
Goals
The main goal of the course is to provide deep understanding of C++ internals - the look on some C++ features from the compiler point of view; how these features are implemented in compiler and why. To show, how this knowledge can help to write short and efficient code.
We’ll discuss the cost of C++ features and the ways to decrease resources needed for application ( memory, time ).
General description
The course is divided into following parts:
1) The brief pass through all features of C++ but on higher level ( example: no explanation what is the meaning of Constructor and Destructor, but the cost of these functions and ways to decrease number of there invocations will be discussed ).
2) Object Oriented Design
3) Design Patterns
4) Standard Template Library, C++ Streams,
5) Pitfalls, Tips
Exercises
· Exercises will be given once in two weeks.
· Students have to do assignments in pairs
· The final grade is based on exam (65%) and assignments (35%).
Syllabus
· What’s going in CTOR & DTOR – the look from Compiler point of view
o Temporary objects
o Why always to provide CTOR and DTOR
· When to return by Reference and when by Value
o Use reference everywhere it possible
· Behind “inline” mechanism
o What happens if compiler doesn’t succeed to INLINE function?
o When really to use INLINE mechanism
o Sometimes it make sense to declare virtual function as inline?
· Operators and Operator Overloading
o Overloading of some specific operators
o Conversion operator and it pitfalls
o Operators New and Delete
§ Overloading
§ How to use overloaded NEW and DELETE to find memory leaks
§ Placement NEW operator
· Templates
o Template Internals
o How to write efficient code using template mechanism
· Exception Handler – www – what, when, why
o Exception Handler in CTORs and DTORs
o Uncaught Exceptions and recovery ( terminate, set_terminate functions)
· Polymorphism –
o Do you really understand the mechanism?
o Internals
o Polymorphism and multiple inheritance
· Pointers to member-functions
o How to declare and use
o How to save a lot of code
· Run Time Type Identification (RTTI)
· C++ – Standard I/O Library – Streams
o Stream manipulators
o Unusual examples of stream usage
· STL – Standard Template Library:
o Containers
o Iterators
o Algorithms
· Class Design
o CONST correctness
o When to declare member-function as virtual and when not
o Data-members: when private and when protected
· Design Patterns
o Creational Patterns
o Behavioral Patterns
o Structural Patterns
· C++ tips and pitfalls
o CTOR & DTOR pitfalls
o Inheritance pitfalls
o Tips for good C++ programming
· Code Optimization
Literature
B.Stroustrup
The C++ Programming Language
Second Edition, Addison-Wesley Publishing Company
B.Stroustrup
The Design and Evolution of C++
Addison-Wesley Publishing Company
S.Lippman
C++ Primer
Second Edition,Addison-Wesley Publishing Company
Scott Meyers
Effective C++
Addison-Wesley Publishing Company
Scott Meyers
More Effective C++
Addison-Wesley Publishing Company
E.Gamma, R.Helm, R.Johnson, J.Vlissides
Design Patterns
Addison-Wesley Publishing Company