H
Henryk
I'm using the gcc with the -pedantic setting.
On my embedded system I need a parameter class that contains all
setting for the software. This class needs to be ROM-able to locate it
in some kind of eprom memory.
Thus, all members of this class are const and there is only one static
instance.
An example header:
class MyParameters
{
public:
MyParameters() : m_nID(1), m_chDeviceName("The_Name") {};
const unsigned char m_nID;
const char m_chDeviceName[9];
};
I get the error:
ISO C++ forbids assignment of arrays .... in the header file.
How can I solve this? The only way I found is to make the class members
static const. Then I can initialize them in the source file:
const char MyParameters::m_chDeviceName[] = "The_Name";
Thank you for your answers
Henryk
On my embedded system I need a parameter class that contains all
setting for the software. This class needs to be ROM-able to locate it
in some kind of eprom memory.
Thus, all members of this class are const and there is only one static
instance.
An example header:
class MyParameters
{
public:
MyParameters() : m_nID(1), m_chDeviceName("The_Name") {};
const unsigned char m_nID;
const char m_chDeviceName[9];
};
I get the error:
ISO C++ forbids assignment of arrays .... in the header file.
How can I solve this? The only way I found is to make the class members
static const. Then I can initialize them in the source file:
const char MyParameters::m_chDeviceName[] = "The_Name";
Thank you for your answers
Henryk