Commit a2e95356 authored by Alexander Hirsch's avatar Alexander Hirsch

Rewording

parent 99684612
......@@ -3,20 +3,19 @@
*due on 5 November 2019*
In this exercise sheet you are asked to set up some infrastructure for developing C++ applications.
The time required for this exercise sheet varies depending on how much experience you have with installing software and setting up build environments.
The time required for this exercise sheet varies depending on how much experience you have with setting up software and build environments.
If you run into problems consult your fellow students first and contact me if the problem persists.
## Task 1 (2 Points)
Install G++ and Clang, then compile the provided file `hello.cpp`.
Be sure to install a version that supports C++17.
Use the following flags when compiling:
-std=c++17 -Wall -Wextra -O2
If you are a Windows user, you may instead use the Visual Studio compiler.
If you are a Windows user, you may instead use Visual Studio.
Adjust the compile flags accordingly.
Alternatively, use [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) instead.
Alternatively, use [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux).
Next, set up [Boost](http://www.boost.org/) on your system and compile the provided file `hello_boost.cpp`.
Boost is quite common and provides you a set of useful C++ libraries.
......@@ -31,7 +30,7 @@ Run Clang on the provided file `vec.cpp` using the following command:
Clang will parse the input file and display its abstract syntax tree (AST).
In the bottom half of the output you'll find the function declaration of `main` followed by its `CompoundStmt`.
Take a close look at its children and compare the resulting AST with the input code.
Notice any oddities something that looks counter intuitive?
Notice any oddities something that looks counter intuitive?
Sometimes looking at the AST of a C++ program helps to understand what is really going on behind the scenes.
Clang is a useful tool for this purpose.
......@@ -44,7 +43,7 @@ Check out the [corresponding section at cppreference](https://en.cppreference.co
The directory `task3` hosts four subdirectories, `libFoo`, `libBar`, `libBaz`, and `app`.
Each folder prefixed with `lib` represents a shared library and contains a header and source file.
Each folder prefixed with `lib` represents a shared library and contains a header plus a source file.
Furthermore, the library `libBaz.so` depends on `libBar.so`.
`app` contains a single source file providing a `main` function.
......@@ -52,26 +51,27 @@ It depends on all three libraries.
![Dependency Graph](images/task3_dependencies.png)
- model this project structure using [CMake](https://cmake.org/)
- be sure to set the C++ standard to C++17 and enable warnings (`-Wall -Wextra`)
- the default build type should be *Release*
- Model this project structure using [CMake](https://cmake.org/)
- Be sure to set the C++ standard to C++17 and enable warnings (`-Wall -Wextra`)
- The default build type should be *Release*
CMake itself is a build system generator.
You can choose from a variety of target build systems.
- use `cmake` to generate the actual build system
- build the project
- Use `cmake` to generate the actual build system
- Build the project
Take note of the following features:
- *out of source build*, generated files do not pollute the source directory
- dependencies of translation-units are automatically obtained
- *Out of source build*, generated files do not pollute the source directory
- Dependencies of translation-units are automatically obtained
What else do you notice?
## Task 4 (Required)
Send me a mail with your team composition, and your side project specification if you chose to do a custom side project.
Send me a mail with your team composition.
If you choose to do a custom side project, also include your side project specification.
Please use the following subject
703807 - Team Composition / Side Project
......
......@@ -10,21 +10,21 @@ Since we won't concern ourselves with templates for the moment your implementati
```cpp
struct Vec2 {
int x, y;
float x, y;
};
```
- read the documentation regarding *smart pointers*, `unique_ptr`, and `shared_ptr`
- implement your version of `unique_ptr_to_vec2` and `shared_ptr_to_vec2` fulfilling these requirements:
- *dynamically* allocate an instance of `Vec2` in your constructor (initialise `x` and `y` to `0`)
- deallocate the `Vec2` instance in your destructor
- implement correct copy semantics (copy constructor / copy assignment)
- implement correct move semantics (move constructor / move assignment)
- enable access to `Vec2` via the operators `*` and `->`
- thread-safety for `shared_ptr_to_vec2`'s reference counter is not required
- pay attention to corner-cases like self-assignment (`v = v`)
- prepare a few interesting test cases for your presentation
- check your implementation for memory leaks and memory corruption using `valgrind`
- Read the documentation regarding *smart pointers*, `unique_ptr`, and `shared_ptr`
- Implement your version of `unique_ptr_to_vec2` and `shared_ptr_to_vec2` fulfilling these requirements:
- *Dynamically* allocate an instance of `Vec2` in your constructor (initialise `x` and `y` to `0.0`)
- Deallocate the `Vec2` instance in your destructor
- Implement correct copy semantics (copy constructor / copy assignment)
- Implement correct move semantics (move constructor / move assignment)
- Enable access to `Vec2` via the operators `*` and `->`
- Thread-safety for `shared_ptr_to_vec2`'s reference counter is not required
- Pay attention to corner-cases like self-assignment (`v = v`)
- Prepare a few interesting test cases for your presentation
- Check your implementation for memory leaks and memory corruptions using `valgrind`
## Task 2 (2 Points)
......@@ -36,7 +36,7 @@ Did you get any compiler warnings?
Investigate what is actually happening (consider using `valgrind` or a debugger).
How can such errors be prevented?
Look for tools (ex: static code analysers) which help discovering such faulty code.
Look for tools (static code analysers) which help discovering such faulty code.
**Note:** If you run the executable and everything seems normal, try changing the initial content of `xs`, using different optimisation flags, or a different compiler.
The actual behaviour of this executable depends on various factors.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment