You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class A {
public:
A(int val): val_(val) {}
int val_;
};
A a1(11);
int b = 123;
void main(void) {
A a2(22);
printk("a1.val_=%d, a2.val_=%d, b=%d\n", a1.val_, a2.val_, b);
}
Prints
a1.val_=0, a2.val_=22, b=123
Notice that a1.val=0 which suggests that the constructor of the static instance a1 was not called (but was called correctly for the local a2).
Per the discussion at https://community.platformio.org/t/class-constructor-is-not-called-for-global-instances/29100
The test program
Prints
Notice that a1.val=0 which suggests that the constructor of the static instance a1 was not called (but was called correctly for the local a2).
My platformio.io is
The text was updated successfully, but these errors were encountered: