23-10-2022, 06:45 AM
Hi,
Does A12-1-1 apply to POD structs? Example:
The members of `Foo` are by default uninitialized. Does A12-1-1 require `Foo` to explicitly initialize its members, like this?
Please note that the above change has some implications, namely that `Foo` is no longer trivial. As such, compilers will warn about performing `memcpy` operations on them. This is a problem for serializer/deserializer type of code.
Thanks!
Does A12-1-1 apply to POD structs? Example:
Code:
struct Foo
{
int x;
int y;
};
The members of `Foo` are by default uninitialized. Does A12-1-1 require `Foo` to explicitly initialize its members, like this?
Code:
struct Foo
Code:
{
Code:
int x{};
Code:
int y{};
Code:
};
Please note that the above change has some implications, namely that `Foo` is no longer trivial. As such, compilers will warn about performing `memcpy` operations on them. This is a problem for serializer/deserializer type of code.
Thanks!