DISTRHO / DPF-Widgets

Official and Community made reusable GUI widgets for DPF
Other
25 stars 4 forks source link

Initial coding style configuration #3

Closed redtide closed 3 years ago

redtide commented 3 years ago

Editorconfig: UTF8 encoding with a space of 4 indentation, removing line trailing spaces and a newline ending every file

clang-format based on WebKit coding style

see also clang-format-configurator.

falkTX commented 3 years ago

Reading through, I agree with everything except:

redtide commented 3 years ago

Reading through, I agree with everything except:

* Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.
  IMO doing stuff like `if (ptr == NULL)` makes it more clear this is not a boolean/variable check but a pointer check. That is, we are not checking if something is true or false, but checking if a pointer is null or not.
  I find the distinction important.

* Static data members should be prefixed by “s_”. Other data members should be prefixed by “m_”.
  This is very, very ugly.
  But it is also very hard to come up with good names for variables, specially for non-native english speakers. Taking from JUCE code style: variables should be named as states and functions as verbs.
  e.g: private var is `position` while function that accesses it are `getPosition` and `setPosition`.
  e.g. private var `count` with `setCount` and `getCount` to access it via functions.

the code style check doesn't warn or force about this, I'm OK with if (ptr) but it doesn't complain otherwise, not even if you use stuff like memberX_, I think that is just for reference.