New repo in kdereview: kalk

Ivan Čukić ivan.cukic at
Sun Feb 21 13:25:30 GMT 2021

Hi all,

Cool idea for the project. I went through the C++ part of the code, and have a 
few suggestions.

> > Please reconsider your decision.

+1 for the plea of not reinventing numerics however fun it is to play with 

For the actual code review:


Item 1:

    if (file.exists()) {;

This should be:
   if (;

The fact that a file exists does not mean open will succeed.

Item 2:

for (const auto &record : qAsConst(array)) {

should be prefixed with:

Item 3:

There is no need to call file.close() as its destructor will close it.

Item 4:

Instead of auto array and qAsConst(array), just declare array to be const:
const auto array = ...
const auto& array = ...

Item 5:

this->save() can be only save(). It is not common to write this-> in C++
unless there is a strong reason to do so in a particular case.

Item 6:

QList<QString> historyList; -> QList<QString> m_historyList;


Item 1:

Great to see a correct C++ singleton :)

Item 2:

You can use std::deque instead of std::stack. You'll get .clear() operation.
It will be more efficient than = {};


Item 1:

Similar to above, when you know the number of elements a collection will have,
call reserve(size) before you start appending (this is for m_units).

BTW, these for loops can be replaced with std::transform and 
std::back_inserter, but I don't want to go overload the review. ;)


dr Ivan Čukić
ivan at,
gpg key fingerprint: 8FE4 D32F 7061 EA9C 8232  07AE 01C6 CE2B FF04 1C12

More information about the kde-core-devel mailing list