#pragma integer literal literal_class lit_class_type_listThe literal_class identifies the type of literal integer involved. The possibilities are:
longto 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
which takes the form below:
lit_class_type_list *int_type_spec integer_constant int_type_spec | lit_class_type_list int_type_spec : : type_name * warningopt : identifier ** :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.
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:
int_type_specis 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 ) VARIETYSince 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.
#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_intis the external identification of a token that returns the integer type according to the rules of ISO C for an unsuffixed decimal;
~lit_hexis the external identification of a token that returns the integer type according to the rules of ISO C for an unsuffixed hexadecimal;
~lit_unsignedis 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_longis 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:
signed_rangeis maximum the minimum range is [-2b-1, 2b-1-1]. Otherwise, if signed_range is symmetric the minimum range is [-(2b-1-1), 2b-1-1];
Part of the TenDRA Web.
Crown Copyright © 1998.