I would like to initialize a short
to a hexadecimal value, but my compiler gives me truncation warnings. Clearly it thinks I am trying to set the short
to a positive value.
short my_value = 0xF00D; // Compiler sees "my_value = 61453"
How would you avoid this warning? I could just use a negative value,
short my_value = -4083; // In 2's complement this is 0xF00D
but in my code it is much more understandable to use hexadecimal.