This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: READ ( UNIT = TRIM(String),...
- From: "François-Xavier Coudert" <fxcoudert at gmail dot com>
- To: "Philippe Schaffnit" <P dot Schaffnit at access dot rwth-aachen dot de>
- Cc: GFortran <fortran at gcc dot gnu dot org>
- Date: 2007年10月29日 10:12:13 +0000
- Subject: Re: READ ( UNIT = TRIM(String),...
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=00jrKCeq4t/jJdiZ4TpEqOw18y07PKyBYPaU2ZUlMwo=; b=RybAW4HoDWYsKJ8IcV3zSzKj+OiskF3arh6T1A0WJCVjqJ0V1SmNAX2Zwl9V0QloCT8duV4uL9fFljqwBcW7EJMZu9pKNCldhLfexUPHmBqmzE/6Aw+H22cll0vfrYa2CvF+xdXLFtLp27VsairSD3owqQtpwT4fWNxIFnZL+8Y=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=TaM/6Io3tAm2WzkXuFYkwZqt2dWaqkXdZrxLSZCu1BQw2IYuf1Z8GXjk73YT8tOiC3G0NOb6RYPy79n6HVkGUU8D8UXGKCuR3SA345OZZFofbsvkvrWPhqgQptp3GQMYKtXJJgyHgvu7eJJrgKWnlF+l+LMU0A0Qm5a9tnkI8G4=
- References: <4725AA67.BCA91E04@access.rwth-aachen.de>
> READ ( UNIT = TRIM(String), FMT = *, IOSTAT = IO_Stat ) Number
> 1
> Error: UNIT specification at (1) must be an INTEGER expression or a
> CHARACTER variable
>
> Is this warranted by the standard?
Yes. From Fortran 2003, section 9.4 "File Connection":
R901 io-unit is file-unit-number or * or internal-file-variable
R902 file-unit-number is scalar-int-expr
R903 internal-file-variable is char-variable
So gfortran's message is very much on par.
> Now for the really weird part, if I remove the 'TRIM' to get over this,
> I would expect an IO error to be raised, but I have yet to find a
> compiler which does!
I don't know. Since gfortran's behaviour is similar to other
compilers, it's probably a language question and would be better
directed to comp.lang.fortran.
FX