08-210r1 To: J3 From: Michael Ingrassia Subject: Public Comment J32002 Date: 2008 June 18 Commenter's Subject was "Fortran 2008 comment". The Fortran 2008 standard provides intrinsic procedures for conversion between different kinds of logical, integer, real and complex types. It does not, however, provide such functionality for characters. As conversion between different character kinds is allowed in assignment statements, the way it happens is already specified and little work is required to add an conversion intrinsic. Such a conversion intrinsic would be useful, especially in a number of cases where it allows for a more compact coding style, compared to having an extra variable and using an assignment statement. Some examples of this, reported by GNU Fortran users who tested the recently added UCS-4 support, include converting a wide character string when passing it to a routine (such as error-reporting routine, or informational argument to a library routine) that expects a character argument of the default kind; this is particularly interesting in the case where the user has no control over the library function. To add such an intrinsic, I suggest adding the following text to section 13.6: CHARACTER (STRING [, KIND]) Description. Conversion between kinds of characters. Class. Elemental function. Arguments. STRING shall be of type character. KIND (optional) shall be a scalar integer initialization expression. Result Characteristics. Character. If KIND is present, the kind type parameter is that specified by the value of KIND; otherwise, the kind type parameter is that of default character type. The length of the result is the same as the length of STRING. Result Value. The result is the conversion of STRING to the result kind type parameter, under the same rules as character intrinsic assignment. Each character of the result is equal to ACHAR(IACHAR(c) [, KIND]), where c is the character at the same position in STRING. Example. On a processor where SELECTED_CHAR_KIND("ISO_10646") has the value 4, CHARACTER ("ABC", 4) has the value 4_"ABC". The following line should also be added to Table 13.1 (section 13.5): Procedure: CHARACTER Arguments: (STRING [, KIND]) Class: E Description: Conversion between kinds of characters.