Re: Select case restrictions

From: Richard E Maine (nospam_at_see.signature)
Date: 12/17/04

Date: Fri, 17 Dec 2004 11:24:25 -0800

"James Van Buskirk" <> writes:

> integer, parameter :: ik1 = selected_int_kind(2)
> select case(x)
> case(200)

> I couldn't find anything in
> the f95 standard document about this.

I can (I think).

The code looks fine to me. There is no requirement that the case
values be of the same kind as the case-expr. (It would be a PITA
if there were such a requirement, as you would have to decorate all
the selectors with a kind number - not just keep them in range).

The operations of comparison are all well defined between integers
of diffferent kinds. See (whereever that stuff is in chapter 7).
This is not different in principle from writing

  if (ik1 == 200) then ...

The result should always be false, but it is "clearly" a valid
expression. The CASE construct is defined in terms of expressions
like this.

Richard Maine                       |  Good judgment comes from experience;
email: my first.last at org.domain  |  experience comes from bad judgment.
org: nasa, domain: gov              |        -- Mark Twain