Microchip Technology SW006023-3N 数据表

下载
页码 238
Implementation-Defined Behavior
 2012 Microchip Technology Inc.
DS51686E-page 197
18.12 STRUCTURES, UNIONS, ENUMERATIONS, AND BIT FIELDS
18.13 QUALIFIERS
ISO Standard:
“A member of a union object is accessed using a member of a different 
type (C90 6.3.2.3).”
Implementation:
The corresponding 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 conditions.
ISO Standard:
“Whether a “plain” int bit field is treated as a signed int bit field or 
as an unsigned int bit field (C90 6.5.2, C90 6.5.2.1, C99 6.7.2, C99 
6.7.2.1).”
Implementation:
By default, a plain 
int
 bit field is treated as a signed integer. This 
behavior can be altered by use of the 
-funsigned-bitfields
 
command line option.
ISO Standard:
“Allowable bit field types other than 
_Bool
, signed int, and 
unsigned int
 (C99 6.7.2.1).”
Implementation:
No other types are supported.
ISO Standard:
“Whether a bit field can straddle a storage unit boundary (C90 6.5.2.1, 
C99 6.7.2.1).”
Implementation:
No.
ISO Standard:
“The order of allocation of bit fields within a unit (C90 6.5.2.1, C99 
6.7.2.1).”
Implementation:
Bit fields are allocated left to right.
ISO Standard:
“The alignment of non-bit field members of structures (C90 6.5.2.1, C99 
6.7.2.1).”
Implementation:
Each member is located to the lowest available offset allowable accord-
ing to the alignment restrictions of the member type.
ISO Standard:
“The integer type compatible with each enumerated type (C90 6.5.2.2, 
C99 6.7.2.2).”
Implementation:
If the enumeration values are all non-negative, the type is 
unsigned 
int
, else it is 
int
. The 
-fshort-enums
 command line option can 
change this.
ISO Standard:
“What constitutes an access to an object that has volatile-qualified type 
(C90 6.5.3, C99 6.7.3).”
Implementation:
Any expression which uses the value of or stores a value to a volatile 
object is considered an access to that object. There is no guarantee 
that such an access is atomic.
If an expression contains a reference to a volatile object but neither 
uses the value nor stores to the object, the expression is considered an 
access to the volatile object or not depending on the type of the object. 
If the object is of scalar type, an aggregate type with a single member 
of scalar type, or a union with members of (only) scalar type, the 
expression is considered an access to the volatile object. Otherwise, 
the expression is evaluated for its side effects but is not considered an 
access to the volatile object.
For example:
volatile int a;
a; /* access to ‘a’ since ‘a’ is scalar */