J3/04-250
To: J3
From: Craig Dedo
Date: February 16, 2004
Subject: Unsigned Integer Data Type
Number:
Title: Unsigned Integer Data Type
Submitted By: Craig Dedo
Status: For Consideration
References:
Basic Functionality:
The next Fortran standard should require processors to offer full
support for unsigned integers as well as signed integers. This support
should be required for all types of integers, i.e. for every signed type
of integer, there should be an unsigned type.
Rationale:
Many systems libraries (e.g. Microsoft Windows) are written in
other languages and require the use of unsigned integers as arguments to
certain functions and subroutines. The availability of unsigned
integers will make the interface to these functions and subroutines much
more straightforward than it is now. Also, for some types of variables,
there is no need for negative values. This feature could also make
Fortran more attractive as a development language for systems programmers.
Specification of intrinsic data types is a feature that is
inherently part of the definition of a programming language. Since
there is no standard, there could be different and incompatible
implementations from different vendors.
Estimated Impact:
There would be no impact on existing codes. This feature is
implemented in nearly every other popular programming language, so the
technical specification is well understood.
Vendors have indicated that implementing this feature may be a high
cost work item, since new data types affect all parts of the compiler.
However, since unsigned integers are widely implemented in other
languages, vendors could benefit from this experience.
Detailed Specification:
This could be implemented by having an UNSIGNED keyword immediately
prior to the keyword INTEGER in the data type declaration.
There is some disagreement on what the rule should be when binary
operations operate on both signed and unsigned integers. There are
three basic approaches:
1. Value-preserving
2. Unsigned-preserving
3. Prohibit operations between unsigned and signed integers.
The C and C++ programming languages use the value-preserving rule.
Because these languages are so widely used, this rule is
well-understood, so it would be best to use the value-preserving rule.
History: