After fixing some other compile errors, the compiler complained about the initialization again.
My understanding is that initialization lists are needed to initialise const variables on the line that they are declared.
How is that done for an array of const pointers? This syntax did not work:
Proc.h:20: error: expected (' before '[' token Proc.h:20: error: uninitialized member 'Proc::row' with 'const' type 'Row* const [3]' Proc.h:20: error: expected {' before '[' token
I think that the first thing you need to do is quit trying to initialize anything in the header file.
I think that the second thing you need to do is define what, exactly, need to be const. If the pointer supposed to be const, so it can't be pointed anywhere else? Or, is the pointer memory supposed to be const, so you can't change the memory that it points to.
I'd try writing the code without worrying about const-ness. When the code works when you are careful not to fk with stuff you aren't supposed to fk with, then you can add the const qualifier, to prevent other people from fking with stuff they aren't supposed to fk with.
Thanks PaulS. That's some good advice.
This works:
class Proc
{
private:
R1 row0;
R1 row1;
//Row * const row[numRows] = { &row0, &row1 };//worked in g++, use it on next version of ino
// ino error: a brace-enclosed initializer is not allowed here before '{' token
Row * row[numRows];
public:
Proc();
Row * getRow(int r) { return row[r]; };
};
Proc::Proc() // this worked on Arduino 1.0.5
{
row[0]=&row0;
row[1]=&row1;
}