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')' voiddenotes the empty type.booldenotes the Boolean type, with two values:trueandfalse, represented as 1 and 0, respectively.float32andfloat64denote the binary32 and binary64 IEEE 754 floating-point types, respectively.int8,int16,int32, andint64denote signed, two’s-complement integers with sizes 8 bits, 16 bits, 32 bits, and 64 bits, respectively.uint8,uint16,uint32, anduint64denote unsigned integers with sizes 8 bits, 16 bits, 32 bits, and 64 bits, respectively.intmaxis a synonym for the largest signed integer type supported by the compiler.uintmaxis a synonym for the largest unsigned integer type supported by the compiler.uintaddris 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.intaddris a synonym for a signed integer type at least as large asuintaddr.uintsizeis 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.intsizeis a synonym for a signed integer type at least as large asuintsize.struct,enum, orunionfollowed by an identifier denotes the type with the given nature and name, which should be available in the compilation context when used.Enclosing a
Typein 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.