cancel
Showing results for 
Search instead for 
Did you mean: 

What is the right initialization of array of pointers to members of the c++ 17 class?

IK.1
Associate II

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?

Help, please!

And thank u in advance!!!

11 REPLIES 11
IK.1
Associate II

https://community.arm.com/developer/ip-products/processors/f/cortex-m-forum/5941/could-you-explain-bcc-command-to-me

here is interesting information about bcc command, may be it would be better to use bne command instead of bcc.

i don’t use Hal library that’s why I can’t tell u anything about it.

IK.1
Associate II

And I didn't see smthg like this ldr r2, =_sbss. Is there such code?