"Unsigned / int mixup (?)"
Hello.
In a struct:
Code:
<...>
unsigned upper : 4;
<...>
The above 'upper' field is populated by a int mySQL field whose value is a bit-field with 4 possible values (that stack, e.g. a row whose value is 15): 1|2|4|8. the value is introduced to the var as:
Code:
instance->upper = atoi(var-with-result-from-mysql);
I've faced this for the first time today, I didn't get why/how it works -- I thought it was broken and would leak/overflow.
Are you able to clarify this for me?
Thank you for your time.