dustinlacewell / vcv-minilab3

6 stars 0 forks source link

good form to initialize all member variables in the declaration #2

Open squinkylabs opened 1 year ago

squinkylabs commented 1 year ago

It's essential that all struct/class members be initalized. It looks like your constructor all do that fine. To me, it’s always a good idea to initialize very member variable directly.

So instead of:

PadBinder* binder;

I would say

PadBinder* binder = nullptr;

This will prevent mysterious issues in the future, where things aren't initializied at all and different random things will occur. This is of course not necessary at all. Most VCV modules probably don't do this. It is, for example, required where I work.

dustinlacewell commented 1 year ago

Actually noticed one time when I was fighting a bug that some fields seemed to have random values and this is probably why. Good one!