Microchip Technology SW006022-1N Hoja De Datos
MPLAB
®
XC16 C Compiler User’s Guide
DS52071B-page 30
2012 Microchip Technology Inc.
2.4.11.2
DIFFERENCES
All compilers have performed right shifting as described in this section.
2.4.11.3
MIGRATION TO THE CCI
No action required.
2.4.12
Conversion of Union Member Accessed Using Member With
Different Type
Different Type
If a union defines several members of different types and you use one member identi-
fier to try to access the contents of another (whether any conversion is applied to the
result) is implementation-defined behavior in the standard. In the CCI, no conversion is
applied and the bytes of the union object are interpreted as an object of the type of the
member being accessed, without regard for alignment or other possible invalid condi-
tions.
fier to try to access the contents of another (whether any conversion is applied to the
result) is implementation-defined behavior in the standard. In the CCI, no conversion is
applied and the bytes of the union object are interpreted as an object of the type of the
member being accessed, without regard for alignment or other possible invalid condi-
tions.
2.4.12.1
EXAMPLE
The following shows an example of a union defining several members.
union {
signed char code;
unsigned int data;
float offset;
} foobar;
Code that attempts to extract offset by reading data is not guaranteed to read the
correct value.
correct value.
float result;
result = foobbar.data;
2.4.12.2
DIFFERENCES
All compilers have not converted union members accessed via other members.
2.4.12.3
MIGRATION TO THE CCI
No action required.
2.4.13
Default Bit-field int Type
The type of a bit-field specified as a plain int will be identical to that of one defined
using unsigned int. This is quite different to other objects where the types int,
signed
using unsigned int. This is quite different to other objects where the types int,
signed
and signed int are synonymous. It is recommended that the signedness of
the bit-field be explicitly stated in all bit-field definitions.
2.4.13.1
EXAMPLE
The following shows an example of a structure tag containing bit-fields which are
unsigned integers and with the size specified.
unsigned integers and with the size specified.
struct OUTPUTS {
int direction :1;
int parity :3;
int value :4;
};