考虑以下:
struct Foo
{
char c;
int i;
};
void Bar(void)
{
struct Foo f = {0}; // use zero initializer
// do some stuff
f = (struct Foo) {'h', 1}; // copy different data into f, is this dangerous?
}
上面的演员会被认为是危险的吗?这是好风格吗?
考虑以下:
struct Foo
{
char c;
int i;
};
void Bar(void)
{
struct Foo f = {0}; // use zero initializer
// do some stuff
f = (struct Foo) {'h', 1}; // copy different data into f, is this dangerous?
}
上面的演员会被认为是危险的吗?这是好风格吗?