1. A
    1. API
    2. ASAN
    3. Access specifiers
  2. C
    1. Constructor
    2. const
  3. G
    1. GDB
    2. g++
  4. M
    1. Make
    2. Memory Leak
  5. P
    1. Pointer
  6. R
    1. Recursion
  7. S
    1. std
  8. V
    1. Valgrind
Completed: / exercises

Forming Groups in Lovelace

Purpose of Groups

Lovelace uses groups primarily for two purposes. The first is sharing of answers between group members. If a task is marked as group submission eligible and one group member answers it, the answer along with any results are shared to all group members. Results include correctness and the amount of points received from the task. The second use of groups is related to reservation calendars. If one group member reserves a slot from the calendar, all members are marked into the same reservation.


This is a short guide to forming a group in Lovelace. To start, choose "Group info" from the top right drop down menu.
Picture showing the top right drop down menu
Open the menu from the highlighted button
A group is formed by one student, who then invites the other members. Only one member of a group should create one. Students who already belong to a group cannot be invited to other groups. However the system should be able to automatically remove groups that have only one member if that member accepts an invitation to another group. All invitees must be enrolled in the same course instance.
In order to create a group, simply write the desired group name into the text field as seen in the example below.
Picture showing the group info page for a user with no groups
Fill the group name field to create a group
Once you have created a group, you can send up to N-1 invitations where N is the group maximum size. In order to invite someone, you have to know their user ID. By default this is the same as your university username (i.e. your first and last name shortened together, and postfixed with the last two digits of your starting year), with @oulu.fi attached to the end. E.g. aasitest22@oulu.fi would be the username of the example student seen in these screenshots.
Picture showing the group info page for a user with a group, with the invitations form open
Fill other member(s) into the empty fields under invitations
Once the invitations have been sent, the other members should visit their "Group info" page to see and accept the invitation.
If you have problems with forming a group, please contact course staff and ask them to create the group for you. Include the names and usernames of all members who should be in the group.
API stands for Application Programming Interface. In the context of this course, you can consider the header files to be such interfaces, as they determine what class functions and properties are public and thus accessible from anywhere.
AddressSanitizer (ASAN) is a memory error detector for C/C++. In this course, the makefiles will typically compile an executable that uses ASAN, with "-asan" at the end of its name.
The two notable access specifiers are:
  • public: class members defined after the public keyword are accessible from outside the class.
  • private: class members are generally private by default and thus not accessible from the outside
Constructor is a special non-static member function of a class that is used to initialize objects of its class type. A constructor is called upon initialization of an object. A constructor without arguments is a default constructor, but constructors that take arguments can be defined.
GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it executes -- or what another program was doing at the moment it crashed.
GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:
  • Start your program, specifying anything that might affect its behavior.
  • Make your program stop on specified conditions.
  • Examine what has happened, when your program has stopped.
  • Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another.
GNU Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files. Make gets its knowledge of how to build your program from a file called the makefile, which lists each of the non-source files and how to compute it from other files. When you write a program, you should write a makefile for it, so that it is possible to use Make to build and install the program.
Memory leak means that the program is not freeing up memory it reserves. The memory will be freed when the program terminates, but if a program keeps leaking more and more memory without terminating, it can become a huge issue!
A typical way for memory leaks to occur is reserving memory with new and not calling delete before the pointer goes out of scope.
Pointer variables store a memory address as their value. In other words, they point to some data. The data can be accessed by dereferencing the pointer. (Either like *p or p->...)
A recursive function calls itself from within it. The recursion call must be conditional or it would lead to an infinite loop.
Valgrind is another tool besides ASAN that you can use in this course. It can detect many memory-related errors that are common in C and C++ programs and that can lead to crashes and unpredictable behaviour.
const is a keyword meant to mark something as immutable
  • A const object cannot be modified: attempt to do so directly is a compile-time error, and attempt to do so indirectly (e.g., by modifying the const object through a reference or pointer to non-const type) results in undefined behavior.
  • const keyword on an object's member function prevents the object from being modified in the function
  • Pointer declarations can have 2 const keywords, one to make the data that's pointed at unable to be modified and one to make the pointer itself unable to be modified
Using const improves code readability and prevents accidental modification of objects.
g++ is a C++ compiler that we primarily use for this course. It is the C++ compiler for the GNU compiler collection. You may sometimes see gcc being used instead of g++, which was originally the GNU C compiler, but calling gcc generally also compiles .cpp files as C++. However, calling g++ is preferred.
In C++, std stands for Standard Library, which is a collection of commonly useful classes and functions. Typically, these are defined in the std namespace.