I'm working on some code and stumble onto something like this:
class Foo
{
private:
union {
byte bar;
struct {
byte baz1;
byte baz2;
};
};
};
Now, I'm compiling with warning level 4 under VS 2010 (pure unmanaged) and of course VS complains that nameless struct/union is a nonstandard extension (warning C4201) and I want to fix that warning.
Is there ANY reason at all someone would prefer the above to:
class Foo
{
private:
byte bar;
byte baz1;
byte baz2;
};
Or any reason that changing the former to the latter would break?