位段存值
struct data
{
	int flag:1;
	int other:31;
};
 int f()
{
return 1;
}
int main()
{
	struct data test;
	// test.flag=1;
           test.flag=f();
	if(test.flag==1)
	   cout<<"test.flag  =1"<<endl;//is right 
	else 
	   cout<<"test.flag !=1"<<endl;
	return 0;
	
}

 修改如下
struct data
{
	unsigned int flag:1;
	int other:31;
};
 int f()
{
return 1;
}
int main()
{
	struct data test;
	 
           test.flag=f();
	if(test.flag==1)
	   cout<<"test.flag  =1"<<endl; 
	else 
	   cout<<"test.flag !=1"<<endl;
	return 0;
	
}