here a little example of a problem I got, I know how to fox it but I do not understand why it work on UNO and not on a due...
if you take an enum and try to assign it an int, it work on UNO but did not compile on a DUE. here a quick example:
enum foo { bar, foobar, barfoo };
void setup() {
int valueToEvaluate = 2;
foo myFoo = valueToEvaluate; //this compile only on UNO
//foo myFoo = static_cast<foo>(valueToEvaluate); //this is a DUE version that compile
//do some switch...
/// ===>>error: invalid conversion from 'int' to 'foo' [-fpermissive]
foo myFoo = valueToEvaluate;
}
I want to better understand what append, and is there a way to avoid it in the enum declaration.
There are two different compilers being used. Uno uses avrgcc while Due uses arm-none-eabi-gcc. Different compilers, different tolerances towards implicit casting?
Once again it's that >:( >:( >:( -fpermissive >:( >:( >:( that is enabled in the AVR core.
It was added there after a number libraries failed to compile with GCC 4.9.
There is one more issue with our enums: size and signedness. Is it coherent across different compilers? No, it's not. According to the C++ standard, the underlying type of an enum is semi-defined, because the compiler can choose what integral type to use to represent the enums, so that the type is less then an int if all enum values can be represented with int. Otherwise, it can be any other, bigger type.