**C.1**- Specifying integer literal types**C.2**- The Portability Table

#pragma integer literalTheliteral_class lit_class_type_list

`decimal`

`octal`

`hexadecimal`

`unsigned`

and/or `long`

to specify an unsigned and/or long type respectively.
The values of the integer literals of any particular class are divided
into contiguous sub-ranges specified by the `lit_class_type_list`

which takes the form below:

The first integer constant, i1 say, identifies the range [0,i1], the second, i2 say, identifies the range [i1+1,i2]. The symbol * specifies the unlimited range upwards from the last integer constant. Each integer constant must be strictly greater than its predecessor.lit_class_type_list*int_type_specinteger_constant int_type_spec|lit_class_type_listint_type_spec: :type_name* warning_{opt}:identifier** :

Associated with each sub-range is an *int_type_spec* which
is either a type, a procedure token identifier with an optional warning
(see G.9)or a failure. For each sub-range:

- If the
*int_type_spec*is a type name, then it must be an integral type and specifies the type associated with literals in that sub-range. - If the
`int_type_spec`

is an identifier, then the type of integer is computed by a procedure token of that name which takes the integer value as a parameter and delivers its type. The procedure token must have been declared previously as#pragma token PROC ( VARIETY ) VARIETY

Since the type of the integer is computed by a procedure token which may be implemented differently on different targets, there is the option of producing a warning whenever the token is applied. - If the
*int_type_spec*is **, then any integer literal lying in the associated sub-range will cause the checker to raise an error.

#pragma integer literal decimal 0x7fff : int | 0x7fffffff : long | * : unsigned longdivides unsuffixed decimal literals into three ranges: literals in the range [0, 0x7fff] are of type int, integer literals in the range [0x7fff, 0x7fffffff] are of type long and the remainder are of type unsigned long.

There are four pre-defined procedure tokens supplied with the compiler which are used in the startup files to provide the default specification for integer literals:

`~lit_int`

is the external identification of a token that returns the integer type according to the rules of ISO C for an unsuffixed decimal;`~lit_hex`

is the external identification of a token that returns the integer type according to the rules of ISO C for an unsuffixed hexadecimal;`~lit_unsigned`

is the external identification of a token that returns the integer type according to the rules of ISO C for integers suffixed by U only;`~lit_long`

is the external identification of a token that returns the integer type according to the rules of ISO C for integers suffixed by L only.

Two built-in portability tables are provided. The default reflects the minimal requirements laid down in the ISO C standard. The 32-bit portability table (specified by the passing the -Y32bit option to tchk) reflects the implementation on most modern 32 bit machines. These tables are shown below.

**ISO/ANSI Minimum Requirements Portability Table (default)**

**32 bit Portability table (specified by -Y32bit option)**

The decimal integer associated with each of *char_bits*, *short_bits
*, *int_bits* and *long_bits* gives the minimum
number of bits in the representation of each integer type on all target
machines. For example, if *int_bits* is set to 32 the compiler
will perform its checks in the knowledge that the program will not
be used on a machine whose int types are represented by 16 bits although
they might be represented by 32 or 64 bits.

The minimum integer ranges are deduced from the minimum integer sizes as follows. Suppose b is the minimum number of bits that will be used to represent a certain integral type, then:

- For unsigned integer types the minimum range is [0, 2
^{b}-1]; - For signed integer types if
`signed_range`

is maximum the minimum range is [-2^{b-1}, 2^{b-1}-1]. Otherwise, if*signed_range*is symmetric the minimum range is [-(2^{b-1}-1), 2^{b-1}-1]; - For the type char which is not specified as signed or unsigned,
if
*char_type*is signed then char is treated as signed, if*char_type*is unsigned then char is treated as unsigned, and if*char_type*is either, the minimum range of char is the intersection of the minimum ranges of signed char and unsigned char.

*Part of the **TenDRA Web.Crown
Copyright © 1998.*