> Date: Mon, 29 Mar 1999 08:01:27 -0800 (PST)
> From: Richard Maine <[log in to unmask]>
>
> Klaus Ramstoeck writes:
> > Agreed. And I am aware of at least one f90 compiler which works nicely for me.
> > Alas not NAG, it choked on s.th. like
> > select case
> > case default
> > print *, 'fails to compile'
> > end select
> > as I compiled my program elsewhere (reported earlier here).
> > There were other problems as well which I however failed to nail down like this
> > one.
>
> Two things.
>
> 1. If you have a nice short sample like that, I'd suggest sending a
> bug report. I've found NAG to be quite good about responding to
> well-written bug reports with concise samples.
>
> 2. But the above sample is not legal Fortran. Even if you can get
> some compilers to accept it, I advise against doing something
> so clearly non-standard that has so little obvious need for the
> non-standard feature. I'll do non-standard things when it
> fills a real need, but I don't see this particular syntax as
> falling in that category.
>
> Yes, I can imagine some reasons why one might want a SELECT
> statement that has nothing except for a CASE DEFAULT; for one
> example, one might be planning to add some other cases at some
> later time.
>
> But this isn't a legal syntax for doing so. The parens and
> select-expression on the SELECT CASE statement are not optional;
> even though they don't do much useful in this degenerate case, the
> syntax requires them. The minimum change that occurs to me is to
> make your select statement
>
> select case (0)
>
> With that change, the copy of the NAG compiler that I tried
> (v2.2(303) for Sun Solaris 2 with gcc) worked fine. If you have
> a version that doesn't work with the standard-conforming syntax,
> then send a bug report to NAG.
>
> I could perhaps see merit to making the parens and the
> select-expression optional in this degenerate case where they don't
> really do anything useful. But since that isn't how the standard
> reads, I'd advise against coding that way.
>
> --
> Richard Maine
> [log in to unmask]
Richard,
One place I have used SELECT constructs with nothing between the
SELECT and END SELECT statements, or just a default clause, is in code
that was automatically generated by another program. In any case, earlier
versions of the NAG compiler had a bug as follows. If the case-expr in
the SELECT CASE statement was of type character, and the block was either
empty or contained only a CASE DEFAULT, the compiler would generate
incorrect C code. There was no problem for integer or logical case-exprs
because those constructs were translated to C "switch" blocks, whereas
for characters, the C code generated was if--else if--else. These bugs
have been fixed in the latest versions.
Ron
Ronald Sverdlove Computing Systems Research
[log in to unmask] Sarnoff Corporation
Tel. 609-734-2517 CN 5300
FAX 609-734-2662 Princeton, NJ 08543-5300
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|