4.7. Types¶
-
Type <-
¶ConstType
/PointerType
/ArrayType
/FunctionType
/BasicType
-
ArrayType <-
¶BasicType
'['
Expression
']'
-
FunctionType <-
¶BasicType
'function'
'('
FunctionTypeArgs
?
')'
-
FunctionTypeArgs <-
¶BasicType
(
','
BasicType
)
*
','
?
Todo
define like any of these
-
BasicType <-
¶'void'
/'bool'
/'float32'
/'float64'
/'int8'
/'int16'
/'int32'
/'int64'
/'intaddr'
/'intmax'
/'intsize'
/'uint8'
/'uint16'
/'uint32'
/'uint64'
/'uintaddr'
/'uintmax'
/'uintsize'
/'struct'
identifier
/'enum'
identifier
/'union'
identifier
/'('
Type
')'
void
denotes the empty type.bool
denotes the Boolean type, with two values:true
andfalse
, represented as 1 and 0, respectively.float32
andfloat64
denote the binary32 and binary64 IEEE 754 floating-point types, respectively.int8
,int16
,int32
, andint64
denote signed, two’s-complement integers with sizes 8 bits, 16 bits, 32 bits, and 64 bits, respectively.uint8
,uint16
,uint32
, anduint64
denote unsigned integers with sizes 8 bits, 16 bits, 32 bits, and 64 bits, respectively.intmax
is a synonym for the largest signed integer type supported by the compiler.uintmax
is a synonym for the largest unsigned integer type supported by the compiler.uintaddr
is a synonym for an unsigned integer type large enough to hold any memory address valid on the compilation target; the specific type is implementation defined.intaddr
is a synonym for a signed integer type at least as large asuintaddr
.uintsize
is a synonym for an unsigned integer type large enough to hold any number of bytes which may be contiguously allocated on the compilation target; the specific type is implementation defined.intsize
is a synonym for a signed integer type at least as large asuintsize
.struct
,enum
, orunion
followed by an identifier denotes the type with the given nature and name, which should be available in the compilation context when used.Enclosing a
Type
in parentheses does not have semantic significance, but allows for syntactic disambiguation of constructs that would otherwise be visually ambiguous.Multi-byte integer types should be represented as either big endian or little endian based on the preference of the compilation target platform, i.e. endianness is implementation defined. Compilers targeting less-than-64-bit CPUs may omit support for some explicitly sized basic types, but it would be nice if they provided software support for types not supported in hardware.