ISO/ IEC JTC1/SC22/WG14 N736

					N736 J11/97-099
					Preprocessor arithmetic
					Randy Meyers
					27 June 1997

1  Introduction

This paper provides alternative wording for N698 (Implementation
Defined Integral Types) Section 9.  Four alternatives (A through D) are
offered; the committee should choose one.  Note that alternatives A, B
and D have a common change to "Forward references."


2  Wording Changes

It seems wise to require preprocessing arithmetic to be performed in
the largest integral type that the implementation supports.

Replace the following sentences from Section 6.8.1 (Conditional
inclusion), paragraph 4:
     The resulting tokens comprise the controlling constant expression
     which is evaluated according to the rules of 6.4 using arithmetic
     that has at least the ranges specified in 5.2.4.2, except that
     {int} and {long}, and {unsigned int} and {unsigned long}, act as
     if they have the same representation as, respectively, {long
     long} and {unsigned long long}.

with (Alternative A):
     The resulting tokens compose the controlling constant expression,
     which is evaluated according to the rules of 6.4 using arithmetic
     that has at least the ranges specified in 5.2.4.2, except that
     the signed integer types and the unsigned integer types act as
     if they have the same representation as, respectively, {intmax_t}
     and {uintmax_t} if those types are defined by the {<inttypes.h>}
     header or {long long int} and {unsigned long long int} otherwise.


or with (Alternative B):
     The resulting tokens compose the controlling constant expression,
     which is evaluated according to the rules of 6.4 using arithmetic
     that has at least the ranges specified in 5.2.4.2.

     If the {<inttypes.h>} header defines {intmax_t} and {uintmax_t},
     the signed integer types and the unsigned integer types act as if
     they have the same representation as, respectively, {intmax_t}
     and {uintmax_t}.  Otherwise, the signed integer types and the
     unsigned integer types act as if they have the same
     representation as, respectively, {long long int} and {unsigned
     long long int}.

or with (Alternative C):
     The resulting tokens compose the controlling constant expression,
     which is evaluated according to the rules of 6.4, except that all
     signed integer types and all unsigned integer types act as if they
     had the same representation as, respectively, a single signed
     integer type and its corresponding unsigned integer type.  The
     single signed integer type and corresponding unsigned integer type
     shall have at least the ranges specified in 5.2.4.2 for,
     respectively, {long long int} and {unsigned long long
     int}.[reference new footnote]

     [New footnote] Implementations are encouraged to perform
     preprocessor arithmetic using the types {intmax_t} and
     {uintmax_t} from the {<inttypes.h>} header.

or with (Alternative D):
     The resulting tokens compose the controlling constant expression,
     which is evaluated according to the rules of 6.4, except that all
     signed integer types and all unsigned integer types act as if they
     had the same representation as, respectively, a single signed
     integer type and its corresponding unsigned integer type.  If the
     {<inttypes.h>} header defines {intmax_t} and {uintmax_t}, the
     single signed integer type and corresponding unsigned integer type
     shall be able to represent the values of, respectively, {intmax_t}
     and {uintmax_t}.  Otherwise, the single signed integer type and
     corresponding unsigned integer type shall be able to represent the
     the values of, respectively, {long long int} and {unsigned long long
     int}.


Add Forward reference (Alternatives A, B, or D only):
        Largest integral types (7.4.3)

Note, the above forward reference may have to be adjusted to reflect
the rewrite of the section on <inttypes.h>.