Clicky

Fortran Wiki
CHAR(string) function

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Proposal: There should be a specific intrinsic CHAR function that accepts a character string argument, and returns a character string of kind defined by the KIND= argument. It should also support ENCODING= to support UTF-8 and UTF-16 conversions.

Rationale: The numeric functions INT(), REAL() and CMPLX() are used for both converting value types, and kinds of the same value. Fortran Standards support multiple character kinds, but there is no function to convert among them, other than assignment or an internal write.

Character kind conversion does not seem like a problem now because Fortran compilers generally do not support multiple character kinds. The standards may be avoiding a character kind conversion function because the rules about handling ambiguous conversions get rather complex. The simple answer is to let it be implementation-dependent.

One reason this function is important is that proper C-interoperation code should not assume that Fortran and C strings are interchangeable.

Revised on July 1, 2010 12:44:57 by Joe Krahn (157.98.68.58) (1004 characters / 0.0 pages)
Edit | Back in time (1 revision) | See changes | History | Views: Print | TeX | Source | Linked from: Feature Proposals

AltStyle によって変換されたページ (->オリジナル) /