Refactor for C++11 and Teensy 4.1 - #14
Conversation
rotenbergrr
left a comment
There was a problem hiding this comment.
hi! 👋
thanks for contributing to Midier 🤩
asked you a few qs in the notes.
also, I think that Midier already uses C++11
are you sure the changes you did are required for using the new Arduino IDE?
| }; | ||
|
|
||
| enum class Accidental : char | ||
| enum class Accidental : short |
There was a problem hiding this comment.
char is 1 byte and short is 2 bytes right?
so we increase the memory footprint with this change am I right?
if so, any chance to keep it a single byte?
There was a problem hiding this comment.
I wasn't able to find a signed byte type for Teensy 4.1 so short was the smallest type I could find that can hold negative numbers.
| }; | ||
|
|
||
| enum class Bar : char | ||
| enum Bar : short |
There was a problem hiding this comment.
same here re the char vs short
also, why not using enum class anymore?
There was a problem hiding this comment.
I wasn't able to find a signed byte type for Teensy 4.1 so short was the smallest type I could find that can hold negative numbers.
The class was removed as enum class won't compile:
In file included from /Users/natehouk/Documents/Arduino/libraries/Midier/src/sequencer/sequencer.cpp:1:
/Users/natehouk/Documents/Arduino/libraries/Midier/src/sequencer/sequencer.h:18:10: warning: elaborated-type-specifier for a scoped enum must not use the 'class' keyword
18 | enum class Bar : int8_t
| ~~~~ ^~~~~
| -----
| const auto mspc = mspb / (float)midier::Time::Subdivisions; // ms per click | ||
|
|
||
| if (_clicked == -1) | ||
| if (_clicked == ULLONG_MAX) |
There was a problem hiding this comment.
we initialize _clicked to -1 explicitly, so why not checking against this value as well?
There was a problem hiding this comment.
Because _clicked is a unsigned long long and therefore can't be compared to -1 without throwing a warning. This is to remove the warning.
|
I edited my pull request title to clarify that these changes were required to get it to compile on a Teensy 4.1 board. |
Changes required to compile with C++11 (as of version 1.6.6, the Arduino IDE enables C++11 by default) on a Teensy 4.1 board.