🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.f77
Article #302

Re: Question on "Parameter" statement

#302
From: Andrew Koenig
Date: Wed, 29 Jan 1986 17:03
36 lines
1468 bytes
> The following construction doesn't work (compile-time error) in either 
> ULTRIX f77 or VMS Fortran (on a Microvax).  Should it work?  Does it
> work on any machine/compiler you know of?  Does the f77 standard say
> anything about this?
> 
> 	PARAMETER ( Size = 10 )
> 
> 	CHARACTER * Size string

You have to write

	CHARACTER * (Size) string

From The Fortran 77 standard, page 8-6, lines 25ff:

	[the length is]

	(1) An unsigned, nonzero, integer constant

	(2) An integer constant expression (6.1.3.1)
	    enclosed in parentheses and with a positive
	    value

	(3) An asterisk in parentheses, (*)

The parentheses are necessary to avoid ambiguity.  Consider

	parameter (x = 1, xy = 2)
	character * xy z

Remember that spaces are irrelevant in Fortran.  Now: is this last
statement to be interpreted as written or as:

	character * x yz

?  Both are valid and there's no way to tell.
Technical Details
Message-ID: <4893@alice.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!alice!ark
References: <410@cubsvax.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!alice!ark
From: ark@alice.UucP (Andrew Koenig)
Newsgroups: net.lang.f77
Subject: Re: Question on "Parameter" statement
Message-ID: <4893@alice.UUCP>
Date: Wed, 29-Jan-86 12:03:18 EST
Article-I.D.: alice.4893
Posted: Wed Jan 29 12:03:18 1986
Date-Received: Thu, 30-Jan-86 06:30:53 EST
References: <410@cubsvax.UUCP>
Organization: Bell Labs, Murray Hill
Lines: 36