These are the slides of my talk organized at the Université de Nantes, on March 13, 2014, by the student association in computer science ASCII. [Update Nov. 2016]
The target audience is people with some C++ knowledges interested by learning good practices and common pitfalls.
Asynchronous operations are getting more and more popular. To the point that we are getting frameworks and environments revolving strictly around that concept. Boost.ASIO, Twisted and node.js are notable example. We will not explore that area. We will focus on techniques for making asynchronous more readable. We will present different currently used solutions. At the end we will introduce coroutines and explain the concept. We will show how these can be integrated with asynchronous code and what we benefit from using coroutines in asynchronous code.
This slides describes the basic concepts of industrial-strength compiler design. This includes basic concept of static single-assignment form (SSA) and various optimizations such as dead code elimination, global value numbering, constant propagation, etc. This is intend for a 150 minutes undergraduate compiler class.
lFuzzer - Learning Input Tokens for Effective FuzzingBjörn Mathis
Modern fuzzing tools like AFL operate at a lexical level: They explore the input space of tested programs one byte after another. For inputs with complex syntactical properties, this is very inefficient, as keywords and other tokens have to be composed one character at a time. Fuzzers thus allow to specify dictionaries listing possible tokens the input can be composed from; such dictionaries speed up fuzzers dramatically. Also, fuzzers make use of dynamic tainting to track input tokens and infer values that are expected in the input validation phase. Unfortunately, such tokens are usually implicitly converted to program specific values which causes a loss of the taints attached to the input data in the lexical phase.
In this paper we present a technique to extend dynamic tainting to not only track explicit data flows but also taint implicitly converted data without suffering from taint explosion. This extension makes it possible to augment existing techniques and automatically infer a set of tokens and seed inputs for the input language of a program given nothing but the source code. Specifically targeting the lexical analysis of an input processor, our lFuzzer test generator systematically explores branches of the lexical analysis, producing a set of tokens that fully cover all decisions seen. The resulting set of tokens can be directly used as a dictionary for fuzzing. Along with the token extraction seed inputs are generated which give further fuzzing processes a head start. In our experiments, the lFuzzer-AFL combination achieves up to 17% more coverage on complex input formats like JSON, LISP, tinyC, and JavaScript compared to AFL.
Presentation of features already voted into C++20 Standard Draft in Toronto, Albuquerque, and Jacksonville ISO C++ Committee Meetings as well as the overview of other really promising proposals that have high chances to arrive in C++20.
simple pattern printing programme in c language for beginners.
here you can see code with its pattern programme and easily can understand the programme.
Asynchronous operations are getting more and more popular. To the point that we are getting frameworks and environments revolving strictly around that concept. Boost.ASIO, Twisted and node.js are notable example. We will not explore that area. We will focus on techniques for making asynchronous more readable. We will present different currently used solutions. At the end we will introduce coroutines and explain the concept. We will show how these can be integrated with asynchronous code and what we benefit from using coroutines in asynchronous code.
This slides describes the basic concepts of industrial-strength compiler design. This includes basic concept of static single-assignment form (SSA) and various optimizations such as dead code elimination, global value numbering, constant propagation, etc. This is intend for a 150 minutes undergraduate compiler class.
lFuzzer - Learning Input Tokens for Effective FuzzingBjörn Mathis
Modern fuzzing tools like AFL operate at a lexical level: They explore the input space of tested programs one byte after another. For inputs with complex syntactical properties, this is very inefficient, as keywords and other tokens have to be composed one character at a time. Fuzzers thus allow to specify dictionaries listing possible tokens the input can be composed from; such dictionaries speed up fuzzers dramatically. Also, fuzzers make use of dynamic tainting to track input tokens and infer values that are expected in the input validation phase. Unfortunately, such tokens are usually implicitly converted to program specific values which causes a loss of the taints attached to the input data in the lexical phase.
In this paper we present a technique to extend dynamic tainting to not only track explicit data flows but also taint implicitly converted data without suffering from taint explosion. This extension makes it possible to augment existing techniques and automatically infer a set of tokens and seed inputs for the input language of a program given nothing but the source code. Specifically targeting the lexical analysis of an input processor, our lFuzzer test generator systematically explores branches of the lexical analysis, producing a set of tokens that fully cover all decisions seen. The resulting set of tokens can be directly used as a dictionary for fuzzing. Along with the token extraction seed inputs are generated which give further fuzzing processes a head start. In our experiments, the lFuzzer-AFL combination achieves up to 17% more coverage on complex input formats like JSON, LISP, tinyC, and JavaScript compared to AFL.
Presentation of features already voted into C++20 Standard Draft in Toronto, Albuquerque, and Jacksonville ISO C++ Committee Meetings as well as the overview of other really promising proposals that have high chances to arrive in C++20.
simple pattern printing programme in c language for beginners.
here you can see code with its pattern programme and easily can understand the programme.
Scope and Closures in JavaScript
I have made a YouTube video on this topic. So, please feel free to click on the link below to better understand JavaScript.
Video Link: https://www.youtube.com/watch?v=PJJ5qAcNlwQ&list=PL0yG7EPFn4R8lmhfP36cV-G9nx6CEBewo
I am Bernard. I am a C Programming Assignment Help Expert at programminghomeworkhelp.com. I hold a Ph.D. in Computer Science from, University of Leeds, UK. I have been helping students with their homework for the past 12 years. I solve assignments related to C Programming.
Visit programminghomeworkhelp.com or email support@programminghomeworkhelp.com.You can also call on +1 678 648 4277 for any assistance with C Programming assignments.
C++ Concepts and Ranges - How to use them?Mateusz Pusz
These are the slides from my Meeting C++ 2018 talk. You can find the recording here: https://www.youtube.com/watch?v=pe05ZWdh0N0. All my other talks can be found here: https://train-it.eu/resources.
---
The most of the Concepts TS and Ranges TS is merged into the C++20 standard draft document. The talk will present a current design of those features and will provide suggestions on how to use them in our source code. That presentation is meant to inspire discussion on how should we use those long-awaited features while building tools and the C++ Standard Library.
Lab Manual IV (1).pdf on C++ Programming practiceranaibrahim453
C++ Programming C++ involves writing code to solve problems or create software applications using the C++ programming language. C++ is a powerful and versatile programming language widely used for developing system software, application software, device drivers, embedded software, and much more.Here are some key aspects of C++ programming:
Syntax: C++ syntax is similar to C, but with additional features such as classes, inheritance, polymorphism, templates, and more.
Object-Oriented Programming (OOP): C++ supports OOP, allowing you to organize code into classes and objects, encapsulate data, and implement inheritance, polymorphism, and abstraction.
Standard Template Library (STL): C++ includes a rich set of libraries called the Standard Template Library (STL), which provides containers (like vectors, lists, maps), algorithms (sorting, searching), and other utilities.
Memory Management: C++ gives you control over memory management, allowing you to allocate and deallocate memory using new and delete operators. However, this also means you need to manage memory carefully to avoid memory leaks and other issues.
Performance: C++ is known for its performance and efficiency. It allows low-level manipulation of resources, direct access to hardware, and efficient use of memory.
Platform Independence: C++ code can be compiled to run on different platforms, making it suitable for cross-platform development.
Compile-Time Polymorphism: C++ supports both compile-time polymorphism (achieved through function overloading and templates) and runtime polymorphism (achieved through inheritance and virtual functions).
Exceptions Handling: C++ provides exception handling mechanisms to deal with runtime errors and anomalies gracefully.
IO Streams: C++ offers powerful input/output capabilities through the use of IO streams, which provide a flexible and easy-to-use interface for reading from and writing to files, the console, and other sources.
Multi-threading: C++ has support for multi-threading, allowing you to create concurrent programs for better performance and responsiveness.
When programming in C++, it's essential to pay attention to memory management, avoid undefined behavior, and follow best practices to write efficient and maintainable code. Additionally, understanding the language's features and utilizing them effectively can lead to more robust and elegant solutions. If you have any specific questions or need help with a particular aspect of C++ programming, feel free to ask!Templates: C++ supports templates, allowing you to write generic code that works with any data type. Templates are powerful tools for creating reusable and flexible code.
Lambda Expressions: C++11 introduced lambda expressions, which provide a concise way to define anonymous functions. Lambdas are useful for writing inline functions, especially in algorithms and callback scenarios.
Smart Pointers: C++11 introduced smart pointers (std::unique_ptr, std::shared_ptr, std::weak_ptr), which h
These are the slides from my C++Now 2018 talk. You can find the recording here: https://www.youtube.com/watch?v=y7PBciQp0B8. All my other talks can be found here: https://train-it.eu/resources.
---
Presentation of features already voted into C++20 Standard Draft in Toronto, Albuquerque, and Jacksonville ISO C++ Committee Meetings as well as the overview of other really promising proposals that have high chances to arrive in C++20.
Pass your CPA Exam - C++ Certified Associate Programmer CPA with us get updated study dumps for your Exam visit@ https://www.troytec.com/CPA-exams.html
#CPA #C++ #Certified #Associate #Programmer
Scope and Closures in JavaScript
I have made a YouTube video on this topic. So, please feel free to click on the link below to better understand JavaScript.
Video Link: https://www.youtube.com/watch?v=PJJ5qAcNlwQ&list=PL0yG7EPFn4R8lmhfP36cV-G9nx6CEBewo
I am Bernard. I am a C Programming Assignment Help Expert at programminghomeworkhelp.com. I hold a Ph.D. in Computer Science from, University of Leeds, UK. I have been helping students with their homework for the past 12 years. I solve assignments related to C Programming.
Visit programminghomeworkhelp.com or email support@programminghomeworkhelp.com.You can also call on +1 678 648 4277 for any assistance with C Programming assignments.
C++ Concepts and Ranges - How to use them?Mateusz Pusz
These are the slides from my Meeting C++ 2018 talk. You can find the recording here: https://www.youtube.com/watch?v=pe05ZWdh0N0. All my other talks can be found here: https://train-it.eu/resources.
---
The most of the Concepts TS and Ranges TS is merged into the C++20 standard draft document. The talk will present a current design of those features and will provide suggestions on how to use them in our source code. That presentation is meant to inspire discussion on how should we use those long-awaited features while building tools and the C++ Standard Library.
Lab Manual IV (1).pdf on C++ Programming practiceranaibrahim453
C++ Programming C++ involves writing code to solve problems or create software applications using the C++ programming language. C++ is a powerful and versatile programming language widely used for developing system software, application software, device drivers, embedded software, and much more.Here are some key aspects of C++ programming:
Syntax: C++ syntax is similar to C, but with additional features such as classes, inheritance, polymorphism, templates, and more.
Object-Oriented Programming (OOP): C++ supports OOP, allowing you to organize code into classes and objects, encapsulate data, and implement inheritance, polymorphism, and abstraction.
Standard Template Library (STL): C++ includes a rich set of libraries called the Standard Template Library (STL), which provides containers (like vectors, lists, maps), algorithms (sorting, searching), and other utilities.
Memory Management: C++ gives you control over memory management, allowing you to allocate and deallocate memory using new and delete operators. However, this also means you need to manage memory carefully to avoid memory leaks and other issues.
Performance: C++ is known for its performance and efficiency. It allows low-level manipulation of resources, direct access to hardware, and efficient use of memory.
Platform Independence: C++ code can be compiled to run on different platforms, making it suitable for cross-platform development.
Compile-Time Polymorphism: C++ supports both compile-time polymorphism (achieved through function overloading and templates) and runtime polymorphism (achieved through inheritance and virtual functions).
Exceptions Handling: C++ provides exception handling mechanisms to deal with runtime errors and anomalies gracefully.
IO Streams: C++ offers powerful input/output capabilities through the use of IO streams, which provide a flexible and easy-to-use interface for reading from and writing to files, the console, and other sources.
Multi-threading: C++ has support for multi-threading, allowing you to create concurrent programs for better performance and responsiveness.
When programming in C++, it's essential to pay attention to memory management, avoid undefined behavior, and follow best practices to write efficient and maintainable code. Additionally, understanding the language's features and utilizing them effectively can lead to more robust and elegant solutions. If you have any specific questions or need help with a particular aspect of C++ programming, feel free to ask!Templates: C++ supports templates, allowing you to write generic code that works with any data type. Templates are powerful tools for creating reusable and flexible code.
Lambda Expressions: C++11 introduced lambda expressions, which provide a concise way to define anonymous functions. Lambdas are useful for writing inline functions, especially in algorithms and callback scenarios.
Smart Pointers: C++11 introduced smart pointers (std::unique_ptr, std::shared_ptr, std::weak_ptr), which h
These are the slides from my C++Now 2018 talk. You can find the recording here: https://www.youtube.com/watch?v=y7PBciQp0B8. All my other talks can be found here: https://train-it.eu/resources.
---
Presentation of features already voted into C++20 Standard Draft in Toronto, Albuquerque, and Jacksonville ISO C++ Committee Meetings as well as the overview of other really promising proposals that have high chances to arrive in C++20.
Pass your CPA Exam - C++ Certified Associate Programmer CPA with us get updated study dumps for your Exam visit@ https://www.troytec.com/CPA-exams.html
#CPA #C++ #Certified #Associate #Programmer
What every C++ programmer should know about modern compilers (w/o comments, A...Sławomir Zborowski
YT: https://www.youtube.com/watch?v=nfDTTxH5DsI
Many C++ programmers (especially beginners) either underestimate or don't actually know the power of modern C++ compilers. In the presentation I discuss architecture of modern compilers, how big they are and features (including recently emerged ones) that everyone should be aware of. I also cover tooling and ecosystem that has grown around compilers.
Diving into HHVM Extensions (Brno PHP Conference 2015)James Titcumb
HHVM is currently gaining popularity at quite a pace, and it's a pretty exciting time for PHP runtimes. Have you ever wondered what is going on beneath this slick and super-speedy engine? I wondered that myself, so I dived into the internals of HHVM, discovering a treasure trove of awesome stuff. In this talk, I’ll show you how HHVM itself works with a guided tour of the codebase, demonstrating how it all pieces together. I’ll also show you a couple of ways to write your own incredible HHVM extension. You don't need to know C++ to understand this talk - just PHP language knowledge is enough.
[E-Dev-Day 2014][5/16] C++ and JavaScript bindings for EFL and Elementary EnlightenmentProject
[E-Dev-Day 2014][5/16] C++ and JavaScript bindings for EFL and Elementary
at Enlightenment Developers Day 2014
https://phab.enlightenment.org/w/events/enlightenment_developer_day_2014/
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
The Art of the Pitch: WordPress Relationships and Sales
How to master C++
1. How to master C++
Florian Richoux
March 13, 2014
Florian Richoux How to master C++ 1/57
2. Licence CC BY-NC-SA 4.0
Attribution-NonCommercial-ShareAlike 4.0 International
This talk is licensed CC BY-NC-SA 4.0.
This license covers the general organization of the material, the textual
content, the gures, etc. except where indicated.
All Calvin and Hobbes images are c Bill Watterson.
This license means that you can share and adapt this course, provided
you give appropriate credit to the author, use the material for
non-commercial purposes and distribute your contributions under the
same license as the original. For more information about this license, see
http://creativecommons.org/licenses/by-nc-sa/4.0/.
Florian Richoux How to master C++ 2/57
4. Why C++?
CC BY 2.0
Florian Richoux How to master C++ 3/57
5. Why C++?
CC BY 2.0
http://www.lextrait.com/vincent/implementations.html
Florian Richoux How to master C++ 3/57
6. Outline
Quick recalls about virtual
Object copy
Memory management
Extra
Randall Munroe, CC BY-NC 2.0
http://xkcd.com/138/
Florian Richoux How to master C++ 4/57
8. Some quick recalls
#i n c l u d e i o s t r e a m
using namespace s t d ;
struct A {
void f ( ) { c o u t Class A e n d l ; }
} ;
struct B : A {
void f ( ) { c o u t Class B e n d l ; }
} ;
i n t main ( ) {
A ∗a = new B ;
a−f ( ) ;
delete a ; // ?
}
Florian Richoux How to master C++ 6/57
9. Some quick recalls
#i n c l u d e i o s t r e a m
using namespace s t d ;
struct A {
void f ( ) { c o u t Class A e n d l ; }
} ;
struct B : A {
void f ( ) { c o u t Class B e n d l ; }
} ;
i n t main ( ) {
A ∗a = new B ;
a−f ( ) ;
delete a ; // ?
}
Output
Class A
Florian Richoux How to master C++ 6/57
10. Some quick recalls
#i n c l u d e i o s t r e a m
using namespace s t d ;
struct A {
v i r t u a l void f ( ) { c o u t Class A e n d l ; }
} ;
struct B : A {
void f ( ) { c o u t Class B e n d l ; }
} ;
i n t main ( ) {
A ∗a = new B ;
a−f ( ) ;
delete a ; // ?
}
Florian Richoux How to master C++ 7/57
11. Some quick recalls
#i n c l u d e i o s t r e a m
using namespace s t d ;
struct A {
v i r t u a l void f ( ) { c o u t Class A e n d l ; }
} ;
struct B : A {
void f ( ) { c o u t Class B e n d l ; }
} ;
i n t main ( ) {
A ∗a = new B ;
a−f ( ) ;
delete a ; // ?
}
Output
Class B
Florian Richoux How to master C++ 7/57
12. Some quick recalls
c l a s s Base
{
. . .
} ;
c l a s s D e r i v e d : public Base
{
~ D e r i v e d ( )
{
// Do some i m p o r t a n t c l e a n u p
}
}
Base ∗b = new D e r i v e d ( ) ;
// u s e b
delete b ; // Here ' s t h e p r o b l e m : ( u s u a l l y ) c a l l ~Base ( )
http:
//stackoverflow.com/questions/461203/when-to-use-virtual-destructors
Florian Richoux How to master C++ 8/57
13. Some quick recalls
c l a s s Base
{
public : v i r t u a l ~Base ( ) { }
} ;
c l a s s D e r i v e d : public Base
{
~ D e r i v e d ( )
{
// Do some i m p o r t a n t c l e a n u p
}
}
Base ∗b = new D e r i v e d ( ) ;
// u s e b
delete b ; // c a l l ~ D e r i v e d ( )
http:
//stackoverflow.com/questions/461203/when-to-use-virtual-destructors
Florian Richoux How to master C++ 9/57
14. Some quick recalls
struct A { v i r t u a l ~A ( ) { } } ;
struct B : A { } ;
struct C { } ;
struct D : C { } ;
i n t main ( ) {
B b ;
A∗ ap = b ;
A a r = b ;
c o u t ap: typeid ( ∗ ap ) . name ( ) e n d l ;
c o u t ar: typeid ( a r ) . name ( ) e n d l ;
D d ;
C∗ cp = d ;
C c r = d ;
c o u t cp: typeid ( ∗ cp ) . name ( ) e n d l ;
c o u t cr: typeid ( c r ) . name ( ) e n d l ;
}
Florian Richoux How to master C++ 10/57
15. Some quick recalls
struct A { v i r t u a l ~A ( ) { } } ;
struct B : A { } ;
struct C { } ;
struct D : C { } ;
i n t main ( ) {
B b ;
A∗ ap = b ;
A a r = b ;
c o u t ap: typeid ( ∗ ap ) . name ( ) e n d l ;
c o u t ar: typeid ( a r ) . name ( ) e n d l ;
D d ;
C∗ cp = d ;
C c r = d ;
c o u t cp: typeid ( ∗ cp ) . name ( ) e n d l ;
c o u t cr: typeid ( c r ) . name ( ) e n d l ;
}
Output
ap: B
ar: B
cp: C
cr: C
Florian Richoux How to master C++ 10/57
16. Some quick recalls
struct A { v i r t u a l ~A ( ) { } } ;
struct B : A { } ;
struct C { } ;
struct D : C { } ;
i n t main ( ) {
B b ;
A∗ ap = b ;
A a r = b ;
c o u t ap: typeid ( ∗ ap ) . name ( ) e n d l ;
c o u t ar: typeid ( a r ) . name ( ) e n d l ;
D d ;
C∗ cp = d ;
C c r = d ;
c o u t cp: typeid ( ∗ cp ) . name ( ) e n d l ;
c o u t cr: typeid ( c r ) . name ( ) e n d l ;
}
Output
ap: B
ar: B
cp: C
cr: C
http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?
topic=%2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Fthe_typeid_operator.htm
Florian Richoux How to master C++ 10/57
18. Copy constructor and copy assignment operator
c l a s s P e r s o n
{
s t d : : s t r i n g name_ ;
i n t age_ ;
public :
P e r s o n ( s t d : : s t r i n g name , i n t age )
: name_ ( name ) , age_ ( age ) { }
} ;
i n t main ( )
{
P e r s o n a ( Bjarne Stroustrup , 6 3 ) ;
P e r s o n b ( a ) ; // What h a p p e n s h e r e ?
b = a ; // And h e r e ?
}
Florian Richoux How to master C++ 12/57
19. Copy constructor and copy assignment operator
// 1 . c o py c o n s t r u c t o r
P e r s o n ( const P e r s o n t h a t )
: name_ ( t h a t . name_ ) , age_ ( t h a t . age_ ) { }
// 2 . c o py a s s i g n m e n t o p e r a t o r
P e r s o n operator=( const P e r s o n t h a t )
{
name_ = t h a t . name_ ;
age_ = t h a t . age_ ;
return ∗ t h i s ;
}
Signature
C l a s s n a m e ( const C l a s s n a m e ) // c o py c t o r
C l a s s n a m e operator=( const C l a s s n a m e ) // a s s i g n m e n t op
Florian Richoux How to master C++ 13/57
20. Copy constructor and copy assignment operator
i n t main ( )
{
P e r s o n a ( Bjarne Stroustrup , 6 3 ) ;
P e r s o n b ( a ) ; // C a l l t h e co p y c t o r
b = a ; // C a l l t h e co p y a s s i g n m e n t o p e r a t o r
P e r s o n c = a ; // ?
}
Florian Richoux How to master C++ 14/57
21. Copy constructor and copy assignment operator
i n t main ( )
{
P e r s o n a ( Bjarne Stroustrup , 6 3 ) ;
P e r s o n b ( a ) ; // C a l l t h e co p y c t o r
b = a ; // C a l l t h e co p y a s s i g n m e n t o p e r a t o r
P e r s o n c = a ; // C a l l t h e co p y c t o r
// ( a l m o s t e q u i v a l e n t t o P e r s o n c ( a ) )
}
More about initializations
http://herbsutter.com/2013/05/09/gotw-1-solution/
Florian Richoux How to master C++ 15/57
22. In which situations is the C++ copy constructor called?
MyClass a ;
MyClass b ( a ) ; // co py c o n s t r u c t o r
// //////////////
void f o o ( MyClass x ) ;
f o o ( a ) ; // co py c o n s t r u c t o r
// ( b u t can be moved i n C++11)
// A s i m p l e t h i n g t o a v o i d t h i s ?
// //////////////
MyClass f o o ( )
{
MyClass temp ;
. . .
return temp ; // co py c o n s t r u c t o r
// ( b u t u s u a l l y RVO a p p l i e s )
}
http://stackoverflow.com/questions/21206359/
in-which-situations-is-the-c-copy-constructor-called
Florian Richoux How to master C++ 16/57
23. In which situations is the C++ copy constructor called?
MyClass a ; // c o n s t r u c t o r
MyClass b ; // c o n s t r u c t o r
a = b ; // co py a s s i g n m e n t op
b = MyClass ( a ) ; // co py c t o r + co py a s s i g n m e n t op
MyClass ∗a = new MyClass ( ) ; // c o n s t r u c t o r
MyClass ∗b ; // n o t h i n g i s c a l l e d
b = a ; // s t i l l n o t h i n g i s c a l l e d
b = new MyClass ( ∗ a ) ; // co py c o n s t r u c t o r
http://stackoverflow.com/questions/21206359/
in-which-situations-is-the-c-copy-constructor-called
Florian Richoux How to master C++ 17/57
24. Why writing a copy ctor and a copy assignment operator?
Question
Why do we need to (sometimes) write them?
Florian Richoux How to master C++ 18/57
25. Why writing a copy ctor and a copy assignment operator?
Question
Why do we need to (sometimes) write them?
Reformulated question
When do we need to write them?
Florian Richoux How to master C++ 18/57
26. Why writing a copy ctor and a copy assignment operator?
Question
Why do we need to (sometimes) write them?
Reformulated question
When do we need to write them?
Answer
Each time you have a class managing resources (like manipulating
memory, pointers)!
Florian Richoux How to master C++ 18/57
27. Why writing a copy ctor and a copy assignment operator?
c l a s s A {
public :
A ( ) { i = new i n t ; }
i n t ∗ i ;
} ;
A a ;
A b = a ;
// same s t o r y w i t h j u s t b = a
s t d : : c o u t a . i s t d : : e n d l b . i s t d : : e n d l ;
Florian Richoux How to master C++ 19/57
28. Why writing a copy ctor and a copy assignment operator?
c l a s s A {
public :
A ( ) { i = new i n t ; }
i n t ∗ i ;
} ;
A a ;
A b = a ;
// same s t o r y w i t h j u s t b = a
s t d : : c o u t a . i s t d : : e n d l b . i s t d : : e n d l ;
Output
0x3A28213A
0x3A28213A
Florian Richoux How to master C++ 19/57
29. Why writing a copy ctor and a copy assignment operator?
c l a s s A {
public :
A ( ) { i = new i n t ; } // c t o r
A( const A o t h e r ) { // co py c t o r
i = new i n t ;
∗ i = ∗( o t h e r . i ) ;
}
i n t ∗ i ;
} ;
A a ;
A b = a ;
// same s t o r y w i t h j u s t b = a
s t d : : c o u t a . i s t d : : e n d l b . i s t d : : e n d l ;
Florian Richoux How to master C++ 20/57
30. Why writing a copy ctor and a copy assignment operator?
c l a s s A {
public :
A ( ) { i = new i n t ; } // c t o r
A( const A o t h e r ) { // co py c t o r
i = new i n t ;
∗ i = ∗( o t h e r . i ) ;
}
i n t ∗ i ;
} ;
A a ;
A b = a ;
// same s t o r y w i t h j u s t b = a
s t d : : c o u t a . i s t d : : e n d l b . i s t d : : e n d l ;
Output
0x3A28213A
0x6339392C
Florian Richoux How to master C++ 20/57
31. The copy-and-swap idiom
I explained you:
What copy ctor and copy assignment operator are.
When they are called.
Why it is important to (sometimes) write them.
But I did not explain yet how to implement them properly.
Good implementation
Apply the copy-and-swap idiom.
Florian Richoux How to master C++ 21/57
32. The copy-and-swap idiom
c l a s s MyClass {
public :
MyClass ( s t d : : s i z e _ t s i z e = 0 ) // c t o r
: s i z e ( s i z e ) ,
a r r a y ( s i z e ? new i n t [ s i z e ] : n u l l p t r )
{}
MyClass ( const MyClass o t h e r ) // co py c t o r
: s i z e ( o t h e r . s i z e ) ,
a r r a y ( s i z e ? new i n t [ s i z e ] : n u l l p t r )
{ s t d : : co py ( o t h e r . a r r a y , o t h e r . a r r a y + s i z e , a r r a y ) ; }
private :
s t d : : s i z e _ t s i z e ;
i n t ∗ a r r a y ;
} ;
http://stackoverflow.com/questions/3279543/
what-is-the-copy-and-swap-idiom/
Florian Richoux How to master C++ 22/57
33. The copy-and-swap idiom
c l a s s MyClass {
. . .
public :
MyClass operator=( const MyClass o t h e r ) // co py asgmt op
{
i f ( t h i s != o t h e r )
{
// p u t i n t h e new d a t a . . .
s t d : : s i z e _ t n e w S i z e = o t h e r . s i z e ;
i n t ∗ n e w A r r a y = n e w S i z e ? new i n t [ n e w S i z e ] : n u l l p t r ;
s t d : : co p y ( o t h e r . a r r a y , o t h e r . a r r a y + s i z e , n e w A r r a y ) ;
// . . . and g e t r i d o f t h e o l d d a t a
delete [ ] a r r a y ;
s i z e = n e w S i z e ;
a r r a y = n e w A r r a y ;
}
return ∗ t h i s ;
}
} ;
Florian Richoux How to master C++ 23/57
34. The copy-and-swap idiom
c l a s s MyClass {
. . .
public :
MyClass operator=( const MyClass o t h e r ) // co py asgmt op
{
i f ( t h i s != o t h e r ) // o f t e n u s e l e s s
{
// p u t i n t h e new d a t a . . .
s t d : : s i z e _ t n e w S i z e = o t h e r . s i z e ;
i n t ∗ n e w A r r a y = n e w S i z e ? new i n t [ n e w S i z e ] : n u l l p t r ;
s t d : : co p y ( o t h e r . a r r a y , o t h e r . a r r a y + s i z e , n e w A r r a y ) ;
// ( t h e s e 3 l i n e s a r e c o d e d u p l i c a t i o n )
// . . . and g e t r i d o f t h e o l d d a t a
delete [ ] a r r a y ;
s i z e = n e w S i z e ;
a r r a y = n e w A r r a y ;
}
return ∗ t h i s ;
}
} ;
Florian Richoux How to master C++ 24/57
35. The copy-and-swap idiom
c l a s s MyClass {
. . .
public :
void swap ( MyClass o t h e r )
{
s t d : : swap ( this −s i z e , o t h e r . s i z e ) ;
s t d : : swap ( this −a r r a y , o t h e r . a r r a y ) ;
}
MyClass operator=( MyClass o t h e r ) // no r e f e r e n c e !
{
swap ( o t h e r ) ;
return ∗ t h i s ;
}
} ;
http://stackoverflow.com/questions/3279543/
what-is-the-copy-and-swap-idiom/
Florian Richoux How to master C++ 25/57
37. The Rule of Three
Rule of 3
If your class needs any of
a destructor,
or a copy constructor,
or a copy assignment operator.
dened explicitly, then it is likely to need all three of them.
Put in other words
If your class manages resources, you need to explicitly dene:
a destructor,
a copy constructor,
and a copy assignment operator.
Florian Richoux How to master C++ 27/57
38. The Rule of Three
These three are linked
What does a copy assignment operator do?
It copies a new state (copy ctor),
and it deletes the old state (destructor).
http://stackoverflow.com/questions/4172722/
what-is-the-rule-of-three
Florian Richoux How to master C++ 28/57
39. The Rule of Three
The rule a delete for each new is not sucient!
c l a s s A
{
public :
A( i n t i ) : a r r a y _ ( i ? new i n t [ i ] : n u l l p t r ) { }
~A ( ) { delete [ ] a r r a y _ ; }
private :
i n t ∗ a r r a y _ ;
} ;
A ∗a1 = new A ( 4 2 ) ;
A ∗a2 = new A ( 2 4 ) ;
. . .
( ∗ a1 ) = ( ∗ a2 ) ;
. . .
delete a1 ;
delete a2 ;
Florian Richoux How to master C++ 29/57
40. The Rule of Three
The rule A delete for each new is not sucient!
c l a s s A
{
public :
A( i n t i ) : a r r a y _ ( i ? new i n t [ i ] : n u l l p t r ) { }
~A ( ) { delete [ ] a r r a y _ ; }
private :
i n t ∗ a r r a y _ ;
} ;
A ∗a1 = new A ( 4 2 ) ;
A ∗a2 = new A ( 2 4 ) ;
. . .
( ∗ a1 ) = ( ∗ a2 ) ; // Memory l e a k !
. . . // We h a v e l o s t o r i g i n a l a1 ' s a r r a y _
delete a1 ;
delete a2 ; // U n d e f i n e d b e h a v i o r !
Florian Richoux How to master C++ 30/57
41. C++11 and move semantics
c l a s s V e c t o r {
i n t ∗ s t o r a g e _ ;
s i z e _ t s i z e _ ;
public :
// c t o r
V e c t o r ( s i z e _ t numElements )
: s t o r a g e _ ( new i n t [ numElements ] ) ,
s i z e _ ( numElements )
{ }
// d t o r
~ V e c t o r ( ) { delete [ ] s t o r a g e _ ; }
} ;
http://kholdstare.github.io/technical/2013/11/23/
moves-demystified.html
Florian Richoux How to master C++ 31/57
42. C++11 and move semantics
http://kholdstare.github.io/technical/2013/11/23/
moves-demystified.html
Florian Richoux How to master C++ 32/57
43. C++11 and move semantics
V e c t o r c = a + b ;
? ? ? operator+ ( V e c t o r const a , V e c t o r const b ) ;
http://kholdstare.github.io/technical/2013/11/23/
moves-demystified.html
Florian Richoux How to master C++ 33/57
44. C++11 and move semantics
V e c t o r c = a + b ;
? ? ? operator+ ( V e c t o r const a , V e c t o r const b ) ;
Return by value seems bad.
http://kholdstare.github.io/technical/2013/11/23/
moves-demystified.html
Florian Richoux How to master C++ 33/57
45. C++11 and move semantics
V e c t o r c = a + b ;
? ? ? operator+ ( V e c t o r const a , V e c t o r const b ) ;
Return by value seems bad.
Return a pointer is bad too: you must make disallocation
somewhere, and can't chained + operations (like a+b+c).
http://kholdstare.github.io/technical/2013/11/23/
moves-demystified.html
Florian Richoux How to master C++ 33/57
46. C++11 and move semantics
V e c t o r c = a + b ;
? ? ? operator+ ( V e c t o r const a , V e c t o r const b ) ;
Return by value seems bad.
Return a pointer is bad too: you must make disallocation
somewhere, and can't chained + operations (like a+b+c).
Return a reference seems not a good idea either.
http://kholdstare.github.io/technical/2013/11/23/
moves-demystified.html
Florian Richoux How to master C++ 33/57
47. C++11 and move semantics
You need to
move!
Florian Richoux How to master C++ 34/57
48. C++11 and move semantics
Is returning by value really bad?
V e c t o r operator+ ( V e c t o r const a , V e c t o r const b )
{
// c r e a t e r e s u l t o f same s i z e
a s s e r t ( a . s i z e ( ) == b . s i z e ( ) ) ;
V e c t o r r e s u l t ( a . s i z e ( ) ) ;
// compute a d d i t i o n
s t d : : t r a n s f o r m (
a . b e g i n ( ) , a . end ( ) , // i n p u t 1
b . b e g i n ( ) , // i n p u t 2
r e s u l t . b e g i n ( ) , // r e s u l t
s t d : : p l u s int () // b i n a r y o p e r a t i o n
) ;
return r e s u l t ; // RVO u s u a l l y a p p l i e s
}
http://kholdstare.github.io/technical/2013/11/23/
moves-demystified.html
Florian Richoux How to master C++ 35/57
49. C++11 and move semantics
Yes, but...
Reason #1
s t d : : s t r i n g f ( bool cond = f a l s e ) {
s t d : : s t r i n g f i r s t ( first ) ;
s t d : : s t r i n g s e c o n d ( second ) ;
return cond ? f i r s t : s e c o n d ; // r e t u r n u n d e r c o n d i t i o n :
// u s u a l l y no RVO
}
Reason #2
RVO applies when one transfers a value out of a scope.
What if we need to transfer into a scope?
http://kholdstare.github.io/technical/2013/11/23/
moves-demystified.html
http://en.wikipedia.org/wiki/Return_value_optimization
Florian Richoux How to master C++ 36/57
50. C++11 and move semantics
Transferring value into a scope
Ray computeRay ( )
{
V e c t o r o r i g i n ;
V e c t o r d i r e c t i o n ;
. . .
return Ray (
o r i g i n , // COPY!
d i r e c t i o n // COPY!
) ; // c e r t a i n l y RVO
}
http://kholdstare.github.io/technical/2013/11/23/
moves-demystified.html
Florian Richoux How to master C++ 37/57
51. lvalue Vs rvalue
lvalue
c = a + b;
rvalue
c = a + b;
Must be a temporary, non-named value.
http://stackoverflow.com/questions/3601602/
what-are-rvalues-lvalues-xvalues-glvalues-and-prvalues
Florian Richoux How to master C++ 38/57
52. C++11 and move semantics
V e c t o r : : V e c t o r ( V e c t o r o t h e r )
// s h a l l o w co p y
: s t o r a g e _ ( o t h e r . s t o r a g e _ ) ,
s i z e _ ( o t h e r . s i z e _ )
{
// n u l l i f y s o u r c e
o t h e r . s t o r a g e _ = n u l l p t r ;
o t h e r . s i z e _ = 0 ;
}
http://kholdstare.github.io/technical/2013/11/23/moves-demystified.html
Florian Richoux How to master C++ 39/57
53. C++11 and move semantics
Transferring value into a scope
Ray computeRay ( )
{
V e c t o r o r i g i n ;
V e c t o r d i r e c t i o n ;
. . .
return Ray (
s t d : : move ( o r i g i n ) , // moved !
s t d : : move ( d i r e c t i o n ) // moved !
) ; // c e r t a i n l y RVO
}
http://kholdstare.github.io/technical/2013/11/23/
moves-demystified.html
Florian Richoux How to master C++ 40/57
54. The Rule of Four and a Half
When a class manipulates resources
Rule of 4.5
=
Rule of 3
+
dene the move ctor
(+ dene a move assignment operator?)
http://stackoverflow.com/questions/4782757/
rule-of-three-becomes-rule-of-five-with-c11
http:
//stackoverflow.com/questions/3279543/what-is-the-copy-and-swap-idiom
Florian Richoux How to master C++ 41/57
55. RAII and Smart pointers
RAII
Resource Acquisition Is Initialization: release resource automatically.
Some applications
Files,
Network sockets,
Mutex,
Memory.
Smart pointers std::unique_ptr and std::shared_ptr.
Florian Richoux How to master C++ 42/57
56. Rule of Zero
Rule of 0
Using smart pointers (and RAII principle) to manage resources, no need
to explicitly declare dtor, copy ctor, etc.
http://flamingdangerzone.com/cxx11/2012/08/15/rule-of-zero.html
Florian Richoux How to master C++ 43/57
57. Rule of Zero
Rule of 0
Using smart pointers (and RAII principle) to manage resources, no need
to explicitly declare dtor, copy ctor, etc.
You can
rest!
http://flamingdangerzone.com/cxx11/2012/08/15/rule-of-zero.html
Florian Richoux How to master C++ 43/57
59. I did not talk about
const (http://duramecho.com/ComputerInformation/WhyHowCppConst.html)
Exceptions (and C++11 noexecpt)
operator+= and operator+ (and operator++ and stu)
C++ cast
Functors
Most of C++11/14/17 features
(https://github.com/AnthonyCalandra/modern-cpp-features)
Florian Richoux How to master C++ 45/57
60. Safety
Asserts
Use assert. Disable them with the -DNDEBUG compile option.
Valgrind
valgrind leak-check=full show-reachable=yes ./your_program
Wonderful GUI: kcachegrind
Warnings
Try to solve them!
Florian Richoux How to master C++ 46/57
61. Read!
Books
Ecient C++ by Scott Meyers (C++11/14 update soon!)
Exceptionnal C++ by Herb Sutter (C++11/14 update soon!)
Blog
Herb Sutter's Guru of the Week
http://herbsutter.com/category/c/gotw/
Twitter
@isocpp
@cppstack
Florian Richoux How to master C++ 47/57
63. Fonctional C++
John Carmack's blog
http://www.altdevblogaday.com/2012/04/26/
functional-programming-in-c/
Modern Functional Programming in C++
http://zao.se/~zao/boostcon/10/2010_presentations/thu/
funccpp.pdf
C++17: I See a Monad in Your Future!
http://bartoszmilewski.com/2014/02/26/
c17-i-see-a-monad-in-your-future/
Florian Richoux How to master C++ 49/57
64. Template Metaprogramming
Books
Modern C++ Design by Andrei Alexandrescu.
C++ Template Metaprogramming by Dave Abrahams and
Aleksey Gurtovoy.
C++ Templates: The Complete Guide by David Vandevoorde
and Nicolai Josuttis (second edition planned for 2015).
A nice intro
http://www.codeproject.com/Articles/3743/
A-gentle-introduction-to-Template-Metaprogramming
A nice and modern intro
http://www.oreilly.com/programming/free/
practical-c-plus-plus-metaprogramming.csp (Free e-book!)
Florian Richoux How to master C++ 50/57
65. SOLID
Single Responsibility: One reason to exist, one reason to change
Open Closed Principle: Open for extension, closed for modication
Liskov Substitution Principle: An object should be semantically
replaceable for it's base class/interface
Interface Segregation Principle: Don't force a client to depend on an
interface it doesn't need to know about
Dependency Inversion Principle: Depend on abstractions, not
concrete detail or implementations
http://stackoverflow.com/questions/1423597/solid-principles
http://en.wikipedia.org/wiki/SOLID_%28object-oriented_design%29
Florian Richoux How to master C++ 51/57
66. Repository and comments
svn, git, mercurial, ...
Ultimate combo
GitHub + Travis
(http://docs.travis-ci.com/user/getting-started/)
Comments
Comment your code with doxygen
Florian Richoux How to master C++ 52/57
67. Repository and comments
svn, git, mercurial, ...
Ultimate combo
GitHub + Travis
(http://docs.travis-ci.com/user/getting-started/)
Comments
Comment your code with doxygen in English!
Florian Richoux How to master C++ 52/57
70. C++ hiring questions 1/3
How many ways are there to initialize a primitive data type in C++
and what are they?
Why should you declare a destructor as virtual?
What does it mean that C++ supports overloading?
What are examples of overloading in C++?
What is name mangling in C++ and why is it used?
What is an abstract base class?
What is RTTI?
How can you access a variable that is hidden by another variable of
the same name?
What is a namespace and how is it used.
What are the dierences between a class and a struct in C++, and
how does this compare to C?
What are templates? How are they used?
What is a copy constructor and when is it used, especially in
comparison to the equal operator.
What is the dierence between a shallow and a deep copy?
What is the const operator and how is it used?
Florian Richoux How to master C++ 54/57
71. C++ hiring questions 2/3
What are the dierences between passing by reference, passing by
value, and passing by pointer in C++?
When is it and when is it not a good idea to return a value by
reference in C++?
What is the dierence between a variable created on the stack and
one created on the heap?
How do you free memory allocated dynamically for an array? What
are the implications of just using delete?
What is multiple inheritance? When should it be used?
What is a pure virtual function?
What does the keyword mutable do?
What does the keyword volatile do?
What is the STL?
What is a Vector?
What is contained in the algorithms header?
Florian Richoux How to master C++ 55/57
72. C++ hiring questions 3/3
What is the dierence between #include iostream.h and
#include iostream?
What's the dierence between ++i and i++?
What is short circuit evaluation? How can it be used? Why can is
be dangerous?
What is the `,' operator?
What is the only ternary operator? How is it used?
What is the use of a const member function and how can it be used?
How is try/catch used in C++?
Why should you never throw an exception in a destructor?
What is the explicit keyword?
What is the proper way to perform a cast in C++?
What does inline do?
Florian Richoux How to master C++ 56/57