I have a union definition like this, but the values seems not working correctly:
union UDouble
{
double _double;
uchar _uchar[ 8 ];
ushort _ushort[ 4 ];
short _short[ 4 ];
uint _uint[ 2 ];
int _int[ 2 ];
long _long;
ulong _ulong;
};
When I try to set "_uchar[ 8 ]" and get the value from "_ulong", something weird happened.
UDouble ul;
int len = StringLen( symName ) - 1;
if ( len > 8 ) len = 8;
ul._long = 0;
//The "ul._ulong" is equal to 0 still okayint o = StringToCharArray( symName, ul._uchar, 0, len );
//But After the StringToCharArray(), the "ul._long" is keeping 0, but the "ul._ulong" has been changed.
The "_long" or "_ulong" will be keeping 0 after the function "StringToCharArray()" if I clear it before, but the other one will be correct
value.
For example, if I set the "_long" to 0, after calling "StringToCharArray()", the "_ulong" will be new correct value, but the "_long" is still
0.
And If I set the "_ulong" to 0, after calling "StringToCharArray()", the "_long" will be new correct value, but the "_ulong" is still 0.
I have a union definition like this, but the values seems not working correctly:
When I try to set "_uchar[ 8 ]" and get the value from "_ulong", something weird happened.
The "_long" or "_ulong" will be keeping 0 after the function "StringToCharArray()" if I clear it before, but the other one will be correct value.
For example, if I set the "_long" to 0, after calling "StringToCharArray()", the "_ulong" will be new correct value, but the "_long" is still 0.
And If I set the "_ulong" to 0, after calling "StringToCharArray()", the "_long" will be new correct value, but the "_ulong" is still 0.