I'm using VS 2019 with VisualGDB extension for STM32F303VC device. I have a class TlteCom
with array of pointers to members of the C++ 17 class. Here it is:
class TlteCom
{
public:
volatile uint16_t number=0;
volatile uint16_t paramNumber=0;
volatile char param1[20];
volatile char param2[20];
volatile char param3[8];
constexpr static uint8_t paramCount = 3;
volatile char *const paramlist[paramCount] = {(volatile char *)param1, (volatile char *)param2,
(volatile char*)param3};
volatile uint16_t paramlength[paramCount] = { 0, 0, 0 };
};
I create the object of the class as global variable as follows: TlteCom com;
I don't understand why com.paramlist
members are all zero. if I create object of the TlteCom
class on stack in main()
function everything is ok: com.paramlist
has right values of param1
, param2
, param3
addresses. So, what is the right initialization of pramlist
array?