mgastner / cartogram-cpp

Cartogram generator in C++
MIT License
8 stars 4 forks source link

Fix control flow for equal area #130

Closed adisidev closed 2 years ago

adisidev commented 2 years ago

This change is quite small and should be relatively fast to review. It only has 2 commits and will make reviewing code much easier in the future.

We should stick to one code style and ensure everyone follows it. One of the easiest ways to do this is to use clang-format. clang-format, like pep8 for python, is the de-facto standard for C++. Further, it is pre-installed on most computers, and comes with clang and all LLVM installations; it is also easily available via homebrew, chocolatey and apt. Thus, it is the most widely accessible. Henceforth, I suggest we make it a rule for everyone to use it, rather than having different individuals use different beautifiers. The one caveat is that the block indent feature is only available on a newer build. Thus, although functions arguments will be broken into new lines, the closing parenthesis will not be on its own line.

Further, the control flow for outputting equal area maps is currently very weird, and requires that most of our code is indented, based on a simple entry condition.

Here is some more discussion on entry conditions. https://stackoverflow.com/questions/3922599/is-it-a-bad-practice-to-use-break-in-a-for-loop

For now, as a compromise, I have added it in its own separate block of code.