If I have the following struct:
struct MyStruct {
int *a;
int *b;
};
And initializes it like this:
int some_var;
MyStruct s{
.a = &some_var
};
can I be sure s.b
will be initialized to nullptr
?
EDIT:
Full compiling code, tested with g++ 7.3.0:
// test.cpp
struct MyStruct {
int *a;
int *b;
};
int main()
{
int some_var;
MyStruct s{
.a = &some_var
};
}
If I print the variable values at this sample, b is indeed 0. But I want to know if this behavior is guaranteed by the standard.