add static to avoid multiple definition error when include driver
I2SClocklessVirtualLedDriver.h
- static __default__mapping
- static interruptSource
- static _internalOffsetDisplay;
I'm not a reviewer and am really not part of this project, but just as a drive-by comment, this subtly changes the behavior of some things as some data that used to be globals (intentionally or otherwise) will now appear independently in each compilation unit it's included from.
Would a plain ole multiple include guard perhaps be better?
Again, I have no idea if that's why this PR isnt being applied, reviewed, etc. It's just something I wondered about while skipping around GitHub reading code to put myself to sleep...as one does.
Checking my proposed changes: all is still relevant except replacing ESP_LOG by ICVD_LOG, that’s not needed.
in general, my wish to move things to .cpp also applies here and probably solve the issue as well if these vars go to the .cpp file 😉
Indeed. That would help a lot. Nontrivial code in headers is just a recipe for pain. Think about two source files including this, if they're static, each gets a distinct copy.
Even in c++, ODR violations are no fun to find.
Moving GPSBabel from c to c++ was the best thing I ever did for that project. I just had to wait for c++ to grow up; that want really a viable option in 2001. Today, I'd use std::chrono over QDateTime, but again, I couldn't wait forever. But there are very few reasons to NOT use c++ today, even on embedded You don't have to use it all. Even just as 'c with classes' and a better C (OMG with the implicit conversions and enums decaying to ints.too soon) there's a lot to be gained.
Ranges are actually pretty nice for coding effects.