14-02-2017, 06:00 PM
Just to make sure since several of our customers brought this up lately:
Is the following code compliant on a target where 'int' is 16 bits?
Since the standard C type of '-32768' is 'long' on 16-bit targets, the essential type is the same.
Thus, I believe the code is not compliant.
This seems unfortunate given that the value does fit in the target type; especially since the same code is compliant on targets with 32-bit int.
Is the following code compliant on a target where 'int' is 16 bits?
Code:
int16_t x = -32768;
Since the standard C type of '-32768' is 'long' on 16-bit targets, the essential type is the same.
Thus, I believe the code is not compliant.
This seems unfortunate given that the value does fit in the target type; especially since the same code is compliant on targets with 32-bit int.
<t></t>